cut for whole lines
Eric "Shubes"
plug at shubes.net
Wed Oct 31 17:07:08 MST 2007
Craig White wrote:
> I am trying to script reading the table info from postgres into a file.
>
> I need to get rid of the first 2 and last 2 lines and it should be easy
> but obviously cut is for grabbing bits of lines where I need to remove
> the whole line.
>
> # cat my_tables.txt
> tablename
> -----------------------
> engine_schema_info
> plugin_schema_info
> ...snipped here...
> services
> (43 rows)
>
> I need to lose the top 2 lines:
> tablename
> ---------------
>
> and the bottom two lines
> (43 rows)
> and a blank line (though this would probably be OK)
>
> how do I accomplish via bash or coreutils (like cut)?
>
> Thanks
>
> Craig
>
man head
man tail
You might alternatively use sed to delete the undesired lines, providing
they contain a string you can match with a regex.
--
-Eric 'shubes'
More information about the PLUG-discuss
mailing list