Insert value of column based on file name matching


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Insert value of column based on file name matching
# 8  
Old 08-28-2015
I think that file ABC has all the information.
Code:
while read c1 c2
do
 fname="$c1.txt"
 {
  echo "> -Z$c2"
  cat "$fname"
 } >"$fname.new"
done <"ABC"

This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to insert data into black column( Secound Column ) in excel (.XLSX) file using shell script?

Source Code of the original script is down below please run the script and try to solve this problem this is my data and I want it column wise 2019-03-20 13:00:00:000 2019-03-20 15:00:00:000 1 Operating System LAB 0 1 1 1 1 1 1 1 1 1 0 1 (5 Replies)
Discussion started by: Shubham1182
5 Replies

2. Shell Programming and Scripting

Insert Columns before the last Column based on the Count of Delimiters

Hi, I have a requirement where in I need to insert delimiters before the last column of the total delimiters is less than a specified number. Say if the delimiters is less than 139, I need to insert 2 columns ( with blanks) before the last field awk -F 'Ç' '{ if (NF-1 < 139)} END { "Insert 2... (5 Replies)
Discussion started by: arunkesi
5 Replies

3. Shell Programming and Scripting

Based on column in file1, find match in file2 and print matching lines

file1: file2: I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading): This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
Discussion started by: pathunkathunk
2 Replies

4. Shell Programming and Scripting

awk print non matching lines based on column

My item was not answered on previous thread as code given did not work I wanted to print records from file2 where comparing column 1 and 16 for both files find rows where column 16 in file 1 does not match column 16 in file 2 Here was CODE give to issue ~/unix.com$ cat f1... (0 Replies)
Discussion started by: sigh2010
0 Replies

5. UNIX for Dummies Questions & Answers

Removing Lines based on matching first column

I have a file1 that looks like this: File 1 a b b c c e d e and a file 2 that looks like this: File 2 b c e e Note that file 2 is the right hand column from file1. I want to remove any lines from file1 that begin with the column in file2. In this case the desired output... (6 Replies)
Discussion started by: kschiltz55
6 Replies

6. Shell Programming and Scripting

Matching 2 files based on one column

Hi, On a similar subject, the following. I have two files: file1.txt dbSNP_rsID,Chromosome,Position,Gene rs10399749,chr. 01,45162,? rs4030303,chr. 01,72434,? rs4030300,chr. 01,72515,? rs940550,chr. 01,78032,? rs13328714,chr. 01,81468,? rs11490937,chr. 01,222077,? rs6683466,chr.... (5 Replies)
Discussion started by: swvanderlaan
5 Replies

7. Shell Programming and Scripting

Matching words based on column headers

Hi , Pls help on this. Input file: NAME1 BSC1 TEXT ID 1 MAINSFAIL TEXT ID 2 DGON TEXT ID 3 lOADONDG NAME2 BSC2 TEXT ID 1 DGON TEXT ID 3 lOADONG (1 Reply)
Discussion started by: bha148
1 Replies

8. Shell Programming and Scripting

Insert new line based on numerical number of column

My input file: Class Number Position Range 1 Initial 50 1 Initial 50 2 Terminal 150 2 Terminal 20 2 Single 10 3 Single 20 4 Double 50 5 Initial 50 5 Initial 60 Class Number... (11 Replies)
Discussion started by: patrick87
11 Replies

9. Shell Programming and Scripting

insert text into another file after matching pattern

i am not sure what i should be using but would like a simple command that is able to insert a certain block of text that i define or from another text file into a xml file after a certain match is done for e.g insert the text </servlet-mapping> <!-- beechac added - for epic post-->... (3 Replies)
Discussion started by: cookie23patel
3 Replies

10. Shell Programming and Scripting

Insert comma based on max number of column

Hi, I am new to unix shell shell scripting. I have a specific requirement where I need to append comma's based on the max number of column in the file. Eg: If my source file look something like this, sengwa,china tom,america,northamerica smith,america walter My output file... (8 Replies)
Discussion started by: nicholas_ejn
8 Replies
Login or Register to Ask a Question
LETTERIZE(1)							    Miscellanea 						      LETTERIZE(1)

NAME
letterize_ - phone-number to letter-mnemonic generator SYNOPSIS
letterize nnnnnnn DESCRIPTION
This program tries to help you find a letter mnemonic matching a given phone number. It emits to standard output each possible pronounceable mnemonic, one per line, using the American standard mapping of dial letters to numbers (2 goes to ABC, 3 to DEF, 4 to GHI, 5 to JKL, 6 to MNO, 7 to PRS, 8 to TUV, 9 to XYZ). The program uses a table of pronounceable letter-triples derived from a dictionary scan. Each potential mnemonic must be such that all of its letter-triples are in the table to be emitted. About 30% of possible triples are considered pronounceable. A typical 7-digit phone number has 19,683 possible mnemonics, but this test usually cuts the list down to a few hundred or so, a reasonable number to eyeball-check. For some numbers, the list will, sadly, be empty. It's best to leave out punctuation such as dashes and parens. BUGS
The filtering method doesn't know what plausible medial triples are not reasonable at the beginnings and ends of words. I'm not sure what table position 0 (which is what 0 and 1 are mapped to) means. If you figure it out, you tell me. I really should have generated my own table, but that would have been more work than this seemed worth -- if your number contains either, you probably need to generate your mnemonic in disjoint pieces around the digits anyway. AUTHOR
Eric S. Raymond esr@snark.thyrsus.com. It's based on a table of plausible letter-triples that had no name attached to it. Surf to http://www.catb.org/~esr/ for updates and related resources. letterize 05/30/2012 LETTERIZE(1)