Friday, September 02, 2005

Issue with join command

Re: Issue with join command
Posted By Don Rowland On Saturday, August 13, 2005 at 8:11 PM

Amit S

Try this:

file1 contents:
file1 - line1
file1 - line2
file1 - line3
file1 - line4

file2 contents:
file2 - line1
file2 - line2
file2 - line3
file2 - line4

Shell script append:

#! /bin/ksh
#
## append line from file2 to end of line from file1
#
awk '{
FRONT = $0
getline BACK < "file2"
print FRONT BACK
}' file1

Output:

./append
file1 - line1file2 - line1
file1 - line2file2 - line2
file1 - line3file2 - line3
file1 - line4file2 - line4

No space between FRONT and BACK.

Don

0 Comments:

Post a Comment

<< Home