The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
How can I replace multiple lines from different files
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
How can I replace multiple lines from different files
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
02-07-2007
sb008
Registered User
Join Date: Jan 2007
Posts: 384
I'm sure the real (n)awk experts have a better solution.
nawk '/^Name[ ]*:/ { NAM=$0 }; /^Address[ ]*:/ { ADDR=$0 }; /^City[ ]*:/ { print NAM"|"ADDR"|"$0 }' file1.txt | paste -d"|" - file2.txt | nawk '{ FS="|" } { print $1; print $4; print $3 }'
sb008
View Public Profile
Find all posts by sb008
Find sb008's past nominations received
Find sb008's present nominations given