1830939 Members
1635 Online
110017 Solutions
New Discussion

delete one line

 
SOLVED
Go to solution
Maurice Skubski
Trusted Contributor

delete one line

hi, i want to delete only the first line in a file (c-shell script). if i try it with sed, it deletes all lines :( what is the solution? thanx for help
TIP: ITO was renamed to VPO. And now with Version 7 it is renamed to OVO (OpenView Operations)
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor
Solution

Re: delete one line

Hi:

Try this:

# sed 1d file.in > file.out

...JRF...
Vincenzo Restuccia
Honored Contributor

Re: delete one line

Edit the file in vi
:1,d
f. halili
Trusted Contributor

Re: delete one line

$ cat test
#! /bin/sh
echo "hello world"
echo "bye ..."

$ sed 1d test > test2

$ cat test2
echo "hello world"
echo "bye ..."

- fnhalili
derekh
Abel Berger
Regular Advisor

Re: delete one line

Hi, try this :

sed 1d [file] > [outputfile]
mv [outputfile] [file]

I holp help you

Regards,

Abel Berger

Mladen Despic
Honored Contributor

Re: delete one line

Another way of doing it:

tail +2 file.in > file.out
Deepak_5
Advisor

Re: delete one line

Hey,

One more way.
awk 'NR>1{print $0}' file.in >file.out

Thanks and Regards
Deepak