Re: for loop example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, Jun 7, 2016 at 5:33 PM, Kenneth Porter <shiva@xxxxxxxxxxxxxxx>
wrote:

> On 6/3/2016 10:41 PM, Indunil Jayasooriya wrote:
>
>> I need a OUTPUT like this
>>
>>
>> *firstname1 lastname1firstname2 lastname2*
>>
>
> An obvious solution is to use Perl. I suggest searching Stackoverflow for
> a solution using that language.
>

  yeah, you are right.


http://stackoverflow.com/questions/18909957/how-to-use-bash-script-to-loop-through-two-files

#!/bin/bash

paste file_in.txt file_out.txt | while read if of; do
  echo "-in $if -out $of"
done


my example.

[root@centos67 loop]# cat file1
firstname1
firstname2

[root@centos67 loop]# cat file2
lastname1
lastname2

[root@centos67 loop]# paste file1 file2 | while read if of; do echo "$
if@xxxxxxxxxxx $of@xxxxxxxxxxx"; done
firstname1@xxxxxxxxxxx lastname1@xxxxxxxxxxx
firstname2@xxxxxxxxxxx lastname2@xxxxxxxxxxx


thanks for your mail.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux