Basic sed doubts

Hi,

I am a newbie to sed environment.
Have been trying to understand some basics of the language,

I am required to replace the occurence of a text string with 0...the command that has been told to me is this

"s/^\s<=k/0/" -e

Can some one please explain me how to
break the command for understanding. AS in

I do know that s is used for substitution and ^ is used to
indicate the begining of the string or something.
Can someone please tell what is the utility of \s.

TIA

  • ^ ... begin of line, as you already pointed out
  • \s ... whitespace character (blank, tab)
  • <=k ... a string literal

sorry to bug u again

s/,[ ]*?[ ]*,/, ,/g

what does this do ?

:frowning:

Substitute the sequence

  • , ... one comma
  • [ ]* ... zero or more blanks
  • ? ... a question mark
  • [ ]* ... zero or more blanks
  • , ... one comma

with

  • , , ... the string comma-blank-comma

and g ... do it for all matches in a line, not only the first

A new question used to appear at the end of this thread. It has been moved here.