I have been working of this script for a very long time and I have searched the internet for direction but I am stuck here.
I have about 3000 files with two columns each. The length of each file is 50000. Each of these files is named this way b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11, b.12 .......b.3000
For example b.4 and b.10 looks like this: b.4
1 1
2 1
3 1
4 0
5 1
6 0.75
7 1
8 1
8 0
9 0.34
10 0.45
.....
50000 1
All the other b. files have the same first column.
I now have another file named 'list'. list has just one column with 3000 lines.
cat $ ls list:
4
7
10
...
3000
I want to list to compare the b.4, b.5, b.6, b.7, b.8, b.9, b.10, b.11,....... to b.3000. Then print out two columns of 3000 lines from these files common to file "list". The output should look like this:
4 0 1
7 1 1
10 0.45 1
..
3000 1 1
Please guys, I need your help. Thanks
I'm confused. Even after replacing your MAN tags with CODE tags in your original posting (which makes it easier to see what your code may be trying to do), you have for files, but never use $files. In echo $file > ff.$file is undefined and ff. isn't used. In the paste fn1 ffn fnuse.temp, none of the operands are are defined by this script.
Am I correct in assuming that you're trying to create a file that contains 3000 lines each of which contains 3001 columns where the 1st column is the line numbers chosen from the 50000 line b.* files as specified by home/john/list and the remaining columns are the 2nd column of each of the b.* files?
Do you realize that if this is what you want, the result won't be a text file on most systems? By definition, lines in text files are limited to LINE_MAX bytes and LINE_MAX can be as small as 2048 on standards-conforming systems. The common standard utilities like the editors, awk, grep, and sed are only specified to work on text files. About the only utilities guaranteed to work on files with arbitrarily long line lengths are cat, cut, and paste.
If you specify b.* as a specification for your b.* files, do you realize that the order of files processed would be b1, b10, b100, b1000, b11... rather than b1, b2, b3...? Does the order in which these files are processed matter?
Hi,
I want to select columns from multiple files and combine them in one file. The files are simulation-data-files with 23 columns each and about 50 rows. I now use:
cut -f 11 Sweep?wing-30?scale=0.?0?fan2?.txt | pr -3 | awk '{printf("\n%s\t%s\t%s",$1,$2,$3)}' > ../Data_Processed/output.txtI... (1 Reply)
I have about 20 CSV's that all look like this:
"","","","","","","","","","","","","","","",""What I've been told I need to produce is the exact same thing, but with each file now containing the start_code from every other file where the email matches.
It doesn't matter if any of the other... (1 Reply)
Hello,
I am new to unix and need help with a problem. I have 2 files each containing multiple columns of information ie;
File 1 :
A B C D E
1 2 3 4 5
File 2 :
F G
6 7
I would like to merge the information from File 2 to File 1 so that the data reads as follows;
File 1:
A... (4 Replies)
Hi everyone,
I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines).
Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
Hi,
1. Each message starts with date
2. There is blank line between each message
3. Each message does not contain same number of lines.
Any help in merging multiple lines in each message to a single line is much appreciated.
AIX: Korn Shell
Error log file looks like below.
... (5 Replies)
Hi guys,
I have very basic linux experience so I need some help with a problem.
I have 3 files from which I want to extract columns based on common fields between them.
File1:
--- rs74078040 NA 51288690 T G 461652 0.99223 0.53611 3
--- rs77209296 NA 51303525 T G 461843 0.98973 0.60837 3... (10 Replies)
I just tried following
ls *.dat|sort -t"_" -k2n,2|while read f1 && read f2; do
awk '{print}' $f1
awk FNR==1'{print $1,$2,$3,$4,$5,"*","*","*" }' OFS="\t" $f2
awk '{print}' $f2
donegot following result
18-Dec-1983 11:45:00 AM 18.692 84.672 0 25.4 24
18-Dec-1983 ... (3 Replies)
I do have a text file with multiple lines on it. I want to put the lines of text into a single line where ever there is ";"
for example
ert, ryt, yvig,
fgr;
rtyu, hjk, uio,
hyu,
hjo;
ghj, tyu, gho,
hjp, jklo,
kol;
The resultant file I would like to have is
ert, ryt, yvig, fgr;... (2 Replies)
Hello all,
I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person.
In the csv, a person may be listed from one to four times... (9 Replies)
I Want to merge multiple lines based on the 1st field and keep into single record.
SRC File:
AAA_POC_DB.TAB1
AAA_POC_DB.TAB2
AAA_POC_DB.TAB3
AAA_POC_DB.TAB4
BBB_POC_DB.TAB1
BBB_POC_DB.TAB2
CCC_POC_DB.TAB6
OUTPUT
-----------------
'AAA_POC_DB','TAB1','TAB2','TAB3','TAB4'... (10 Replies)