Get data from two text file in one loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get data from two text file in one loop
# 1  
Old 04-07-2009
Get data from two text file in one loop

Hi all

I have two file that contain different data.I want to get each file data line by line in one loop.i try with cat but cat works ok against one file

File a

23
34
45

File b
abc
xyz
cgh

now i want like this in a loop.Below is just example.i am doing some thing smiler.can any one guide me.

ls $filea $fileb
# 2  
Old 04-08-2009
you mean this??
Code:
ls `paste -d" " file1 file2`

# 3  
Old 04-08-2009
Quote:
Originally Posted by aliahsan81
Hi all

I have two file that contain different data.I want to get each file data line by line in one loop.i try with cat but cat works ok against one file

File a

23
34
45

File b
abc
xyz
cgh

now i want like this in a loop.Below is just example.i am doing some thing smiler.can any one guide me.

ls $filea $fileb
Post your sample output....
# 4  
Old 04-08-2009
Actually i mean that

paste file1 file2 | while read a b
do
echo $a $b
done
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to loop file data based on delimiter

My file has data that looks like below: more data.txt I wish to display each string seperated by a delimiter : Expected output: I tried the below but I m not getting every split string on a new line. #!/bin/bash for i in `sed 's/:/\\n/g' data.txt`; do echo -n... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

For loop or while loop from a text file

Hi all, i developed a script to measure the uptime of a process in a Solaris 10/11 environments. All is well, but i came across a situation where there are multiple processes of the same name. Basically i have the following result file: beVWARS 13357 19592122 beVWARS 14329 19591910... (4 Replies)
Discussion started by: nms
4 Replies

3. Shell Programming and Scripting

How to loop a text file to remove the old files?

Hi , I'm using Ksh 88 version. I've a text file which contains the directory names DIR1 DIR2 ---- DIR10 I've to remove the data which has more that 30 days from the above directories . The data has to be removed from the following path cd /home/etc/DIR1/hist cd /home/etc/DIR2/hist... (2 Replies)
Discussion started by: smile689
2 Replies

4. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

5. Shell Programming and Scripting

Run script to export the data to ixf file in loop

Hi, I am trying to export the data to an .ixf file. I have read the table names from a .dat file and those table name should be passed to the select * from schema.TABLENAME query . I am trying the below loop while read TABLE; do db2 EXPORT TO ~/data_export/$TABLE.ixf OF IXF MESSAGES... (5 Replies)
Discussion started by: vikyalex4
5 Replies

6. Shell Programming and Scripting

while loop to add text to the end of a file

Hi all, I've got 2 files. File 1 has a list say a b c d e f File 2 got start= What I want is to create File 3 which look like this start=a,b,c,d,e,f So is it possible to loop throught File1 to echo it into File3 in one line? (3 Replies)
Discussion started by: stinkefisch
3 Replies

7. Shell Programming and Scripting

Find and replace data in text file with data in same file

OK I will do my best to explain what I need help with. I am trying to format an ldif file so I can import it into Oracle oid. I need the file to look like this example. Keep in mind there are 3000 of these in the file. changetype: modify replace: userpassword dn:... (0 Replies)
Discussion started by: timothyha22
0 Replies

8. Shell Programming and Scripting

loop through file to change some data

Hi, I have a file with the following data -0.00000 0.00000 0.00000 F F F 0.00000 0.00000 0.80000 F F F 0.50000 0.50000 0.60000 F F F 0.50000 0.50000 0.20000 F F F -0.00000 0.00000 0.40000 F F F I would like to change the last 3 lines from F F F to T T T. I tried looping each line but don't... (5 Replies)
Discussion started by: princessotes
5 Replies

9. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies

10. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies
Login or Register to Ask a Question