I am trying to write a script that would combine two files into one and should work in both Solaris 5.10 and a Linux box.
File1:
dit710
dit710
dit720
dit720
File2:
FacA D0000000000000001
FacA D0000000000000002
FacA D0000000000000030
FacB D00000000000000980
Desired Output:
dit710,FacA,D0000000000000001
dit710,FacA,D0000000000000002
dit720,FacA,D0000000000000030
dit720,FacB,D00000000000000980
What I tried?
paste File1 File2 |nawk '{$1=$1}1' OFS=","
(Above command works in Solaris but does not work in Linux)
paste File1 File2 |awk '{$1=$1}1' OFS=","
(Above command works in Linux but does not work in Solaris)
I am using Korn Shell. Can someone suggest another way which works in both Solaris and Linux?
Note that File2 may contain more than 3 columns but always have equal number of columns.
paste File1 File2 | tr '[[:blank:]]' ,
– don_crissti Apr 05 '16 at 19:56[[:blank:]]
with a literal tab followed by a space... – don_crissti Apr 05 '16 at 20:45awk
more like other/standard Unixen, see http://unix.stackexchange.com/questions/198905/when-to-use-xpg-version-of-a-command – dave_thompson_085 Apr 06 '16 at 03:14