Maybe this don't to be the best form to solve your problem, but worked,rs.
#!/bin/bash #power by Diego Rodrigues
totalFileOne=$(wc -l file1 | cut -d" " -f1) totalFileTwo=$(wc -l file2 | cut -d" " -f1)
count=0
if [ ! "${totalFileOne}" -eq "${totalFileTwo}" ];then echo "The two files need of same number of lines" exit 1 fi
for ((i=0;$i<${totalFileOne};i++)); do #add more one to some NumberLine=$(( $i+1 )) echo -en $(sed ${NumberLine}'!d' file1 ;sed ${NumberLine}'!d' file2)"\n" done
Em ter, 7 de jun de 2016 às 08:42, centos-request@centos.org escreveu:
Send CentOS mailing list submissions to centos@centos.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.centos.org/mailman/listinfo/centos or, via email, send a message with subject or body 'help' to centos-request@centos.org
You can reach the person managing the list at centos-owner@centos.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of CentOS digest..."
Today's Topics:
- for loop example (Indunil Jayasooriya)
- remote backup (Alessandro Baggi)
Message: 1 Date: Sat, 4 Jun 2016 11:11:21 +0530 From: Indunil Jayasooriya indunil75@gmail.com To: CentOS mailing list centos@centos.org Subject: [CentOS] for loop example Message-ID: <CAJF2yJSdCEysBoqGo2B+BerpgPYBmMxD=ahj4LiHN6xR8H= 3Gg@mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Hi list,
Can you look in to this?
[root@centos67 loop]# cat file1 firstname1 firstname2
[root@centos67 loop]# cat file2 lastname1 lastname2
I need a OUTPUT like this
*firstname1 lastname1firstname2 lastname2*
But I try the below command , i get below output. what is the real command to get the above output
[root@centos67 loop]# for line1 in $(cat file1 ); do for line2 in $(cat file2 ); do echo "$line1" "$line2";done;done; firstname1 lastname1 firstname1 lastname2 firstname2 lastname1 firstname2 lastname2
And also, I created a file3 like this
[root@centos67 loop]# cat file3 firstname1 lastname1 firstname2 lastname2
How can I get the same OUTPUT ?
*firstname1 lastname1firstname2 lastname2*
if I try below command, i get the below output.
[root@centos67 loop]# for i in $(cat file3);do echo $i;done; firstname1 lastname1 firstname2 lastname2
Could you pls help me to solve this ? THIS is very important to me.
-- cat /etc/motd
Thank you Indunil Jayasooriya http://www.theravadanet.net/ http://www.siyabas.lk/sinhala_how_to_install.html - Download Sinhala Fonts
Message: 2 Date: Sat, 4 Jun 2016 12:34:40 +0200 From: Alessandro Baggi alessandro.baggi@gmail.com To: CentOS centos@centos.org Subject: [CentOS] remote backup Message-ID: 5752AEC0.4010609@gmail.com Content-Type: text/plain; charset=iso-8859-15; format=flowed
Hi list, i've need to backup a partition of ~200GB with a local connection of 8/2 mbps.
Tool like bacula, amanda can't help me due to low bandwidth in local server.
I'm thinking rsync will be a good choice.
What do you think about?
Thanks in advance.
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
End of CentOS Digest, Vol 137, Issue 5
There's probably a better way using join, but this should do the trick:
paste <(cat file1 | tr "\n" ' ') <(cat file2 | tr "\n" " ")
On Tue, 07 Jun 2016 12:19:14 +0000 Diego diegofull@gmail.com wrote:
Maybe this don't to be the best form to solve your problem, but worked,rs.
#!/bin/bash #power by Diego Rodrigues
totalFileOne=$(wc -l file1 | cut -d" " -f1) totalFileTwo=$(wc -l file2 | cut -d" " -f1)
count=0
if [ ! "${totalFileOne}" -eq "${totalFileTwo}" ];then echo "The two files need of same number of lines" exit 1 fi
for ((i=0;$i<${totalFileOne};i++)); do #add more one to some NumberLine=$(( $i+1 )) echo -en $(sed ${NumberLine}'!d' file1 ;sed ${NumberLine}'!d' file2)"\n" done
Em ter, 7 de jun de 2016 às 08:42, centos-request@centos.org escreveu:
Send CentOS mailing list submissions to centos@centos.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.centos.org/mailman/listinfo/centos or, via email, send a message with subject or body 'help' to centos-request@centos.org
You can reach the person managing the list at centos-owner@centos.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of CentOS digest..."
Today's Topics:
- for loop example (Indunil Jayasooriya)
- remote backup (Alessandro Baggi)
Message: 1 Date: Sat, 4 Jun 2016 11:11:21 +0530 From: Indunil Jayasooriya indunil75@gmail.com To: CentOS mailing list centos@centos.org Subject: [CentOS] for loop example Message-ID: <CAJF2yJSdCEysBoqGo2B+BerpgPYBmMxD=ahj4LiHN6xR8H= 3Gg@mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Hi list,
Can you look in to this?
[root@centos67 loop]# cat file1 firstname1 firstname2
[root@centos67 loop]# cat file2 lastname1 lastname2
I need a OUTPUT like this
*firstname1 lastname1firstname2 lastname2*
But I try the below command , i get below output. what is the real command to get the above output
[root@centos67 loop]# for line1 in $(cat file1 ); do for line2 in $(cat file2 ); do echo "$line1" "$line2";done;done; firstname1 lastname1 firstname1 lastname2 firstname2 lastname1 firstname2 lastname2
And also, I created a file3 like this
[root@centos67 loop]# cat file3 firstname1 lastname1 firstname2 lastname2
How can I get the same OUTPUT ?
*firstname1 lastname1firstname2 lastname2*
if I try below command, i get the below output.
[root@centos67 loop]# for i in $(cat file3);do echo $i;done; firstname1 lastname1 firstname2 lastname2
Could you pls help me to solve this ? THIS is very important to me.
-- cat /etc/motd
Thank you Indunil Jayasooriya http://www.theravadanet.net/ http://www.siyabas.lk/sinhala_how_to_install.html - Download Sinhala Fonts
Message: 2 Date: Sat, 4 Jun 2016 12:34:40 +0200 From: Alessandro Baggi alessandro.baggi@gmail.com To: CentOS centos@centos.org Subject: [CentOS] remote backup Message-ID: 5752AEC0.4010609@gmail.com Content-Type: text/plain; charset=iso-8859-15; format=flowed
Hi list, i've need to backup a partition of ~200GB with a local connection of 8/2 mbps.
Tool like bacula, amanda can't help me due to low bandwidth in local server.
I'm thinking rsync will be a good choice.
What do you think about?
Thanks in advance.
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
End of CentOS Digest, Vol 137, Issue 5
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos Total Control Panel https://asp.reflexion.net/history-detail?hID=15258593501
From: Indunil Jayasooriya indunil75@gmail.com
[root@centos67 loop]# cat file1 firstname1 firstname2
[root@centos67 loop]# cat file2 lastname1 lastname2
I need a OUTPUT like this
*firstname1 lastname1firstname2 lastname2*
But I try the below command , i get below output. what is the real
command
to get the above output
[root@centos67 loop]# for line1 in $(cat file1 ); do for line2 in
$(cat
file2 ); do echo "$line1" "$line2";done;done; firstname1 lastname1 firstname1 lastname2 firstname2 lastname1 firstname2 lastname2
And also, I created a file3 like this
[root@centos67 loop]# cat file3 firstname1 lastname1 firstname2 lastname2
How can I get the same OUTPUT ?
*firstname1 lastname1firstname2 lastname2*
scott@viviotech.net suggested this:
There's probably a better way using join, but this should do the trick:
paste <(cat file1 | tr "\n" ' ') <(cat file2 | tr "\n" " ")
I'd never used the paste command before, so I tried the above oneliner out and it did not work on my system. It printed all of file1 followed by all of file2.
An altered version of the paste command did work on my centos 7 system.
paste -d' ' file1 file2 Assuming the OP example output was a typo and there should be a space between the contents of file1 and file2. Otherwise remove or change the -d' '
Mike
On Thu, 9 Jun 2016 15:19:57 -0400 Mike Williams dmikewilliams@gmail.com wrote:
From: Indunil Jayasooriya indunil75@gmail.com
[root@centos67 loop]# cat file1 firstname1 firstname2
[root@centos67 loop]# cat file2 lastname1 lastname2
I need a OUTPUT like this
*firstname1 lastname1firstname2 lastname2*
But I try the below command , i get below output. what is the real
command
to get the above output
[root@centos67 loop]# for line1 in $(cat file1 ); do for line2 in
$(cat
file2 ); do echo "$line1" "$line2";done;done; firstname1 lastname1 firstname1 lastname2 firstname2 lastname1 firstname2 lastname2
And also, I created a file3 like this
[root@centos67 loop]# cat file3 firstname1 lastname1 firstname2 lastname2
How can I get the same OUTPUT ?
*firstname1 lastname1firstname2 lastname2*
scott@viviotech.net suggested this:
There's probably a better way using join, but this should do the trick:
paste <(cat file1 | tr "\n" ' ') <(cat file2 | tr "\n" " ")
I'd never used the paste command before, so I tried the above oneliner out and it did not work on my system. It printed all of file1 followed by all of file2.
An altered version of the paste command did work on my centos 7 system.
paste -d' ' file1 file2 Assuming the OP example output was a typo and there should be a space between the contents of file1 and file2. Otherwise remove or change the -d' '
Mike _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos Total Control Panel https://asp.reflexion.net/history-detail?hID=15302122680
Interesting, I don't have the same experience:
cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [PEXPECT]$ paste -d' ' /tmp/file1 /tmp/file2 firstname1 lastname1 firstname2 lastname2 [PEXPECT]$ paste <(cat /tmp/file1 | tr "\n" ' ') <(cat /tmp/file2 | tr "\n" ' ') firstname1 firstname2 lastname1 lastname2