Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Deleting first and last lines of a text file

by Bloodnok (Vicar)
on May 16, 2014 at 10:25 UTC ( [id://1086282]=note: print w/replies, xml ) Need Help??


in reply to Deleting first and last TWO(2) lines of a text file

sed -e '1d;$d' < infile > outfile

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Deleting first and last lines of a text file
by vsmeruga (Acolyte) on May 16, 2014 at 10:43 UTC
    Hi I tried the below shell code. But it removed only first line. Thanks
    #!/bin/sh sed -e '1d;$d' /home/file_20140407.txt >>file_20140407_n.txt
      Works for me ...
      $ sed -e '1d;$d' jaxws/src/share/jaxws_classes/com/sun/xml/internal/me +ssaging/saaj/soap/SOAPDocumentFragment.java > t $ diff jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/sa +aj/soap/SOAPDocumentFragment.java t 1d0 < /* 45d43 < }
      Does your file have a newline as the last character ? You'll experience problems if not.

      A user level that continues to overstate my experience :-))
        I am not seeing any characters at the end of the line when I open in edit plus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1086282]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found