Problem in making a script

amritpal pathak amritpalpathak1 at gmail.com
Thu Jun 30 06:53:37 UTC 2011


On Wed, Jun 29, 2011 at 2:35 PM, Nils Kassube <kassube at gmx.net> wrote:

> amritpal pathak wrote:
> >    Thank you very much .
> >                                             it is working now.it is
> > replacing the user's input with line number 4's content in abc file
> > but it also removes the contents which are after the line number 4
> > i.e 5,6,7 so on.everyline gets remove.
> > It is not feasible
> >
> > Why?
>
> Well, there probably is no file "abc" but only "abc.tex" ...
>  ok Sir
> > tail -n $(($LEN - 4)) "abc" >> "$TEMP"
>
> This line should be
>
> tail -n $(($LEN - 4)) "abc.tex" >> "$TEMP"
>  great !!.
>
    it is working now.you guys are rock!!
                                                               But still i
am little bit confuse to understand it "how it is happening".Please sir,tell
me what each line is doing .It will make me fully understand it

TEMP=$(mktemp)
head -n $((4 - 1)) "abc.tex" > "$TEMP"
echo "$fname" >> "$TEMP"
LEN=$(cat "abc.tex"|wc -l)
tail -n $(($LEN - 4)) "abc.tex" >> "$TEMP"
mv "$TEMP" "abc.tex"
exit 0

 Thank you very much.

amritpalpathakgne.wordpress.com

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110630/73040b76/attachment.html>


More information about the ubuntu-users mailing list