Aligning numbers in the second file based on first file
Hi All,
I have two sets of files with names .dat and .txt. The number of files is really large more than 90000. The files have names like 1.dat, 2.dat,3.dat and so on where as txt files have names like 1.txt, 2.txt, 3.txt and so on
The DAT and TXT files are equal in number. About 90000 each
1.dat files look like this:
and its corresponding 1.txt file looks like this:
Numbers in the first column of 1.dat are also there in 1.txt in some other order. But the numbers present in 1 column in 1.dat are guaranteed to be found in 1.txt also. This goes with 2.dat, 2.txt and 3.dat, 3.txt and so on.
My requirement is to sort the columns in the 1.dat file so that the numbers in first column align with those in the 1.txt. This is what I mean (suppose my output file is 1.aligned):
As you can see, the order of numbers in the first column in 1.align is same as that in 1.txt. Nothing has changed only I have sorted the numbers based on 1.txt and first column of 1.dat and aligned them together in 1.align and I have to do this for all 90000 files.
I have a file that is pipe delimited and in Column F they have number values, both positive and negative. I need to take the one file I am starting with and split it into two separate files based on negative and positive numbers. What is the command to do so? And then I need to also transfer... (4 Replies)
I have a large text file in following format
cat input.txt
abc
qwert
qwer
afweferf
wdfwefwe ==> kjhjkwdd
mnmn ==> jkjkjwekj
poiu ==> lklklke
tytyutut ==> olkjmnsmn
I need to align those lines with the characters " ==>" . I dont want to disturb the lines which dont have "==>".
The... (6 Replies)
Hi,
I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Dear All,
I have to split a tab delimited file in two files based on the presence of a positive or negative in column number 9 , for example
file:
A 1 5 erg + 6766 0.9889 0.9817 9.01882 erg inside upstream
B 1 8 erg2 + 6766 0.9889 0.9817 -9.22 erg2 inside... (3 Replies)
Hello friends
Please help me to display the content of a file in specific aligned manner.
for ex.
the content of the file may be
>$TEST
WELCOME
HI
HELLO
UNIX
SHELL
SCRIPTING
>$
I want to display the content like
.
TEST WELCOME HI
HELLO ... (18 Replies)
Hi All
I have one query,say i have a requirement like the below code should be
move to diffent files whose maximum lines can be of 10 lines.Say in the below example,it consist of 14 lines.
This should be moved logically using the data in the fisrt coloumn to file1 and file 2.The data of first... (2 Replies)
Hello friends,
Is there any way to split file from n to n+6 into 1 file and (n+7) to (n+16) into other file etc.
f.e I have source pipe delimated file with 20 lines and i need to split 1-6 in file1 and 7-16 in file2 and 17-20 in file 3
I need to split into fixed number of file like 4 files... (2 Replies)
Right now there is no unix direct commad that can sort the files base on its name having numbers:
We can use the following:
In case your file name are like:
abc-UP018.zip
xyz-UP019.zip
ls *|sort -t'-' -k2 (2 Replies)
Hi All,
I have a file which is like this:
rows.dat
1 2 3 4 5 6
3 4 5 6 7 8
7 8 9 0 4 3
2 3 4 5 6 7
1 2 3 4 5 6
I have another file with numbers like these (numbers.txt):
1
3
4
5
I want to read numbers.txt file line by line. The extract the row from rows.dat based on the... (3 Replies)
I have to find the number of rows in a file and delete those many rows in another file.
For example, if I have 3 rows in a file A, i have to delete first 3 rows in anothe file B,
I have the code, it works as standalone, when I merge this with m application (c with unix), it doesnt work.
... (2 Replies)