The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
awk script to compare and insert a line
.
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
:
awk script to compare and insert a line
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
11-22-2008
radoulov
addict
Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,926
Given your sample data it seams that
$4
will work fine.
Use
nawk
or
/usr/xpg4/bin/awk
on
Solaris
:
Code:
awk '/^1 / { s = $0 } /^6 / && !t[$4]++ { c++ && $0 = s RS $0 }1' infile
radoulov
View Public Profile
Find all posts by radoulov
Find radoulov's past nominations received
Find radoulov's present nominations given