December 1999
Beginner
528 pages
11h 10m
English
We have now gone over the basics of sed, but what you really use sed for in your scripts or on the shell line is changing or deleting text from strings or files. That’s what we will look at next, using what we have learnt in the previous section.
One task for which you’ll use sed a lot will be stripping off control characters from files that have been downloaded from another system.
Here’s a part of a file (dos.txt) that has been transferred. We’ve got to get rid of all the suspect characters so the accounts department can use the file.
$ pg dos.txt
12332##DISO##45.12^M
00332##LPSO##23.11^M
01299##USPD##34.46^M
...
Here’s what has got to be done:
1. | Replace all the ... |
Read now
Unlock full access