If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
sed '/^[HS]/ d' command will delete all the lines from a file which starts with 'H' or 'S'. But I want to delete all the lines that start with 'H' or 'SLSC' . Can anyone please let me know how to do it?
You can combine different expressions in one sed command. Check your man pages for the exact syntax. In Linux e.g. for a command with several expressions every expression has to be preceded by the -e flag.
Thanks.
I cant get it to work. My actual purpose is different. I want to copy all the lines starting with 'H' or 'SLSC' to a new file.
if it is 'H' or 'S', sed '/^[HS]/ !d' file1 > file2 will do.
but i dont know how to do 'H' and 'SLSC' together. I dont want 'S' alone .
I want to copy all the lines starting with 'H' or 'SLSC' to the second file.