sed command spanning multiple lines



Is it possible to spread a sed command over multiple lines, to improve
readability (for the sake of future maintenance)? If so, what
character is used to break the line and what are the rules?

For example, I would like to re-write the command:

sed -e 's/\.//g' -e 's/\,//g' -e 's/\\//g' "$1" | sort -u > foo

as:

sed -e 's/\.//g'
-e 's/\,//g'
-e 's/\\//g' "$1"
| sort -u > foo

and be able to add additional lines such as:

-e 's/[0-9]//g'


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: Help: about File Mask
    ... Amy Lee wrote: ... And I have a question about the sed command. ... that stand for 'any single character'. ... So read all together as "substitute every single character by a space and ...
    (comp.unix.shell)
  • Re: Sed Command difference between 4.33 and 5.2
    ... I suspect the PSEXAIMS.C file ... the sed command you show does not substitute special characters ... It deletes the first character of each line, ...
    (comp.unix.aix)
  • Re: Can I put a ^M on a command line somehow?
    ... >> Korn shell and Bash shell. ... >> I want to write a little sed command which will remove 0x0d from the end ... chance to interpret the control character symbolism internally. ...
    (comp.unix.shell)
  • Re: ^M character
    ... That should work according to the docs, but on my system I can't get the substr function to take the -1 the way it should. ... This was a 6 character string and it works but for that to work you'd need to know the length of all the columns. ... Or there is also a unix2dos command that can do this for you. ... Or replace the sed command with a unix2dos command ...
    (comp.databases.informix)
  • Re: sed: delete different characters
    ... > Is there a way to do this with one sed command, ... Actually, your pipe removes all left and right brackets, not pairs. ... then only one character will be removed per line. ...
    (comp.unix.shell)