[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Find string and cut file



Jacob Friis Larsen wrote:
> >>Would it be easier if I already now the line number?
> >>(I found it with grep)
> >
> >I think this will do it:
> >
> >sed '/1083300070/,$!d' file

Very close.  Just invert that command.

> I did it like this:
> grep -n "1083300070" updatelog.sql
> sed -n "59507480,999999999p" updatelog.sql > updatelog2.sql &

You can combine the grep and the sed and then only process the file
once.

  sed -n "/1083300070/,$p" updatelog.sql > updatelog2.sql

That also removes the arbitrary 999999999 marker, which is pleasing.

Bob

Attachment: pgpdewJ6f2FLK.pgp
Description: PGP signature


Reply to: