Add unique identifier from file to filetype in directory
I am trying to add a unique identifier to two file extensions .bam and .vcf in a directory located at /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome.
The identifier is in $2 of the input file. What the code below is attempting to do is strip off the last portion of the path in the for.... in the below bash that is R_2016_09_21_14_01_15_user_S5-00580-9-Medexome.
That string appears in the input file and is unique and has 3 lines above it with identifiers in it.
strings in bold are identifiers
There are 3.bam files in /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome, each on will match one $1 value in input. The corresponding $2 value is what is used as the identifier to update the file in /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome.
My actual data is several hundreds of lines but I have included a sample dataset:
input (file to update from) located at /home/cmccabe/s5_files/identifier
files in /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome
desired output
bash
Currently the code does run, but the files do not update with the identifier. There will always be a match between the path and input. Thank you .
Last edited by cmccabe; 11-25-2016 at 09:37 PM..
Reason: fixed format, updated awk
Hi, I know that inode for each file is unique, but is it the for the directory? So far I found different directories has the same inode nubmer when you do ls -i, could some one explain why? Thanks a lot. (9 Replies)
i All
I have scripting question.
I have a file "out.txt"
which is generated by another script
the file contains the following
my_identifier8859574
logout
The number is generated in the script and I have put the my_identifier bit in front of it as a unique identifier
I now have... (7 Replies)
Ok, so I just got charged with the task of deleting some 300 user folders in a FTP server to free up some space. I managed to grep and cut the list of user folders to delete into a list of one user folder per line.
Example:
bob00
jane01
sue03
In the home folder, there are folders a-z, and... (5 Replies)
I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM".
I can find the line number for the beginning of the statement section with sed.
... (5 Replies)
I keep all my files on a NAS device and copy files from it to usb or local storage when needed. The bad part about this is that I often have the same file on numerous places. I'd like to write a script to check if the files in a given directory exist in another.
An example:
say I have a... (7 Replies)
I have 84 files with the following names splitseqs.1, spliseqs.2 etc.
and I want to change the .number to a unique filename.
E.g.
change splitseqs.1 into splitseqs.7114_1#24
and
change spliseqs.2 into splitseqs.7067_2#4
So all the current file names are unique, so are the new file names.... (1 Reply)
Hi,
Here's my dilemma.
I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories
Is this possible?
Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below
I have... (13 Replies)
hi,
I am trying to get the FileType using the File command. I have one file, which holds Group separator along with ASCII character.
It's a Text file.
But when I ran the File command the FileType is coming as "data".
It should be "ASCII, Text file".
Is the latest version of File... (6 Replies)
I have a bash that downloads a list and if that list has data in it then a new main directory is created (with the date) with several subdirectories (example1, example2, example3). My question is in that list there are portion of specific file types (.vcf.gz) - identifier towards the end that have... (0 Replies)