Skip to main content
deleted 9 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 122
  • 242
sed -e 1,/^$/c\\ -e '' <infile >outfile 

...would also work.

As opposed to 1,/^$/d the c\  <<!>newline<!>><EOF> command doesn't delete the address range, exactly, but rather changes the whole block to a single string. And so this will not remove the first blank line from output - because it changes the whole first occurring text block in input (as delimited by the first occurring blank line) to a single blank line.

sed -e 1,/^$/c\\ -e '' 

...would also work.

As opposed to 1,/^$/d the c\  <<!>newline<!>> command doesn't delete the address range, exactly, but rather changes the whole block to a single string. And so this will not remove the first blank line from output - because it changes the whole first occurring text block in input (as delimited by the first occurring blank line) to a single blank line.

sed -e 1,/^$/c\\ -e '' <infile >outfile 

...would also work.

As opposed to 1,/^$/d the c\<EOF> command doesn't delete the address range, exactly, but rather changes the whole block to a single string. And so this will not remove the first blank line from output - because it changes the whole first occurring text block in input (as delimited by the first occurring blank line) to a single blank line.

added 369 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 122
  • 242
sed -e 1,/^$/c\\ -e '' 

...would also work.

As opposed to 1,/^$/d the c\ <<!>newline<!>> command doesn't delete the address range, exactly, but rather changes the whole block to a single string. And so this will not remove the first blank line from output - because it changes the whole first occurring text block in input (as delimited by the first occurring blank line) to a single blank line.

sed -e 1,/^$/c\\ -e '' 

...would also work.

sed -e 1,/^$/c\\ -e '' 

...would also work.

As opposed to 1,/^$/d the c\ <<!>newline<!>> command doesn't delete the address range, exactly, but rather changes the whole block to a single string. And so this will not remove the first blank line from output - because it changes the whole first occurring text block in input (as delimited by the first occurring blank line) to a single blank line.

Source Link
mikeserv
  • 59.4k
  • 10
  • 122
  • 242

sed -e 1,/^$/c\\ -e '' 

...would also work.