I have a directory containing multiple files.
and also a txt file which contains the list of all filenames and certain values.
I want to read the text file line by line and if its 2nd column is matched with the filename in directory, then it must insert the values in 7th column to the filename.
ex: DIR [ a.txt
b.txt
c.txt]
filenamelist.txt
assa dsad werr vdss a.txt is 2.4
assa dsad werr vdss b.txt is 3.2
assa dsad werr vdss c.txt is 4.3
Hi Balajesuri
Thanks for the reply, but unfortunately this code is not working.....
Although its not showing any error..but i am not getting the required output.
what is the function of -e here?
Hi RudiC,
By mistake I wrote column 2, whereas the filename is in column 5. Filename in output is a, b, c followed by underscore and the values in column 7
It is actually printing the above result shown by you but filenames are as such....I basically want to change the filenames as it is printed above.
Please suggest me something to change the filename.
I have a directory containing 1000's of files with extenxion.pdb
like a.pdb
b.pdb
c.pdb
Also, I have a text file which contains 7 columns. Out of which 5th column consists of current filename list and 7th column have some values. which I need to insert in the new filename with an "underscore".
Yes, it is printing the way I wanted but it is not changing the filename.
New filenames with underscore and the required values are printed on screen, but the original file remains as such with previous name.
My problem is to change the filename.
I believe there should be something wrong with the input! awk is taking the 7th field correctly and supplying here. check for extra characters in the 7th field of ur file.