LinuxSA Mailing list archives
Index:
[thread]
[date]
[subject]
[author]
From: Andrew O'Callaghan <androc@box.net.au>
To : Michael Everitt <meveritt@bigpond.com.au>
Date: Thu, 6 Apr 2000 10:32:48 +0930
adding a carriage return to every line (was: help needed with sed problem)
Hi Michael,
thought of another solution using awk instead of sed. This one will add a
carriage return to the end of each line containing the searched field. Try:
awk '/fprintf/ {printf("%s7-7899\n%s8-7899\n",$0,$0)}' <existing_file> > <new_file>
This will search for all the lines containing a fprintf statement, then replace this
line with what is currently on the line and add "7-7899" to the end. It will then
add another line straight after this, but will have "8-8999" added to the end instead.
Let me know if this is what you wanted. Have a look at the awk man page for information
on the syntax of the command, or e-mail me back if you need help.
regards and hope this helps,
Andrew O'C
> If you have
> sed 's/.-..../& 7-7899/' <existing file> > <new file>
>
> How do I then add a differnt number but same position to the next line??
>
> sed 's/.-..../& 7-7899 <newline> 8-9999/' <existing file> > <new file>
--
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject
Index:
[thread]
[date]
[subject]
[author]
Return to the LinuxSA Mailing List Information Page