Sample Header Ad - 728x90

sed: To match a newline and spaces

1 vote
3 answers
132 views
I have a following file:
this is a title
  
    here goes a style sheet
I need to strip the ` element from it, with sed`. Currently I use
cat test.html | sed 's/.*//'
and it works, but I don't understand how to get rid of the blank line. That is, currently the output is
here goes a style sheet
Whereas I want it to be
here goes a style sheet
For this, I tried to add \s* or \n*, using both GNU and BSD sed,
cat test.html | sed 's/.*\s*//'
cat test.html | sed 's/.*\n*//'
but this didn't help. What I'm doing wrong? **Edit:** The `` line doesn't have to be on a separate line. That is, sometime the whole file can be just a single line:
this is a titlehere goes a style sheet
In such a case, the desired output is
here goes a style sheet
Asked by jsx97 (1347 rep)
Aug 6, 2024, 03:09 PM
Last activity: Aug 16, 2024, 06:28 PM