Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do i delete first line of a file. The file starts with page break ^L. The first line contains the page break ^L. The file may have multiple pagebreaks and I don't want to delete from the file. I want answers in unix shell script, using sed or nawk commands or anyting simpler than that.
Any help will be appreciated.

This simple sed command deletes the first line, no matter what the line contains:
sed '1d' data.file > mynewdata.file

Typically, the formfeeds occur at the beginning of the first line of each page. So if you delete the entire line, it will cause the first page to be missing the first line, and all remaining lines on that page will move upward one line.
To delete only the Ctrl-L, and leave the first line there (even if otherwise blank), you can do:
sed 1s/^L// data.file > mynewdata.file
(and key that as an actual Ctrl-L)
or you can use the \f designator:
sed 1s/"\f"// data.file > mynewdata.file

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |