Re: sed command spanning multiple lines
- From: Björn Keil <abgrund@xxxxxxxxxxxxxxxx>
- Date: Wed, 11 Apr 2007 19:34:27 +0200
Russell L. Harris schrieb:
Is it possible to spread a sed command over multiple lines, to improveHello,
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'
sure you can, just as any other command between the arguments, but not
between.
The command lines are interpreted by the shell, not by the programs,
they just get the arguments they were called with as an ordered data
package, but don't usually have anything to do with the way they were
called.
You may escape a linebreak just as any other charater in all Linux/Unix
shells I know, just remember that the <Enter> must come immediately
after the backspace:
sed -e 's/\.//g' \
-e 's/\,//g' \
-e 's/\\//g' "$1" \
| sort -u > foo
Greetings,
Björn
Attachment:
signature.asc
Description: OpenPGP digital signature
- References:
- sed command spanning multiple lines
- From: Russell L. Harris
- sed command spanning multiple lines
- Prev by Date: Re: Creating debian package with ar
- Next by Date: Re: sed command spanning multiple lines
- Previous by thread: sed command spanning multiple lines
- Next by thread: Re: sed command spanning multiple lines
- Index(es):
Relevant Pages
|
|