[CentOS] for loop example
Jon LaBadie
jcu at labadie.us
Tue Jun 7 19:51:46 UTC 2016
On Sat, Jun 04, 2016 at 11:11:21AM +0530, Indunil Jayasooriya wrote:
> Hi list,
>
> Can you look in to this?
>
>
> [root at centos67 loop]# cat file1
> firstname1
> firstname2
>
> [root at centos67 loop]# cat file2
> lastname1
> lastname2
>
> I need a OUTPUT like this
>
>
> *firstname1 lastname1firstname2 lastname2*
>
Assuming your files 1&2 will be longer than 2 lines,
consider this:
paste -d' ' file1 file2 |
awk '(NR%2) == 1 {l1 = $0; getline ; print l1 $0}'
--
Jon H. LaBadie jon at jgcomp.com
11226 South Shore Rd. (703) 787-0688 (H)
Reston, VA 20190 (703) 935-6720 (C)
More information about the CentOS
mailing list