Sponsored Content
Top Forums Shell Programming and Scripting Using filename to determine a prefix that needs to be added to string column on file? Post 302701007 by Corona688 on Friday 14th of September 2012 02:28:56 PM
Old 09-14-2012
Code:
$ awk -F"|" '{ $2=tolower(substr(FILENAME,1,1))"-"$2 } 1' OFS="|" CDD_whatever.txt

01|c-5284338|Person 1|SAT Mail|75

$

Use nawk on solaris.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

remove filename prefix

I've got a bunch of files called oldabc, olddef etc. i want to copy these to be abc, def.... I can do this with file extensions....but can get the logic to work for prefixes. All the files I am interested in have a prefix of 'old'. This loop is no good for me....it looks at the content... (2 Replies)
Discussion started by: peter.herlihy
2 Replies

2. UNIX for Dummies Questions & Answers

Use same filename for prefix in the split command

I want to execute something like this: find . -type f -regex '$REGEX' -print | xargs split -d -C $SIZE The problem is that I want the name of the split files to be the same name as original files. So if my directory has two files called abc.txt and def.txt, then I want the split files to be... (1 Reply)
Discussion started by: namityadav
1 Replies

3. UNIX for Dummies Questions & Answers

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (1 Reply)
Discussion started by: goodmis
1 Replies

4. UNIX for Advanced & Expert Users

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (7 Replies)
Discussion started by: goodmis
7 Replies

5. Shell Programming and Scripting

Prefix a string to the contents of a file

Hi all, I have a requirement where in i have to create a temporary file by prefixing a string of special characters to each row of a input file. the input file is '|' delimited. here is the content of input file aaa|1234|axad|123 bbb|qwqw|qw|1334 the output should be ... (5 Replies)
Discussion started by: nvuradi
5 Replies

6. Shell Programming and Scripting

Execute command on first column (filename) retrieved from a file

Hi, I have a file abcd.txt which in turn contains 20 file names as column 1. Now I want to run a command "ct co -nc" / "cp" / "mv" on each of these $1 column content i.e. on each of the 20 file names. How can do this using a script so that I need not run the same command 20 times... (13 Replies)
Discussion started by: royzlife
13 Replies

7. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

8. UNIX for Dummies Questions & Answers

Add a new column to txt file containing filename

I would like help adding a new column to a large txt file (~10MB) that contains the filename. I have searched other posts but have not found an adequate solution. I need this extra column so I can concatenate >100 files and perform awk searches on this large file. My current txt file look... (4 Replies)
Discussion started by: kellywilliams
4 Replies

9. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

10. Shell Programming and Scripting

Prefix a variable in the first column of all the records of the files with and without header

In a bash shell, I have to prefix a variable to two .CSV files File1.CSV and File2.CSV. One of the files has a header and the other one is with no header in the below format: "value11","value12","value13","value14","value15","value16" "value21","value22","value23","value24","value25","value26"... (7 Replies)
Discussion started by: dhruuv369
7 Replies
DIALTEST(8)						      System Manager's Manual						       DIALTEST(8)

NAME
dialtest - HylaFAX dial string processing rules test program SYNOPSIS
/usr/sbin/dialtest [ options ] dialrules DESCRIPTION
dialtest is an interactive program for the testing and development of dial string processing rules used by HylaFAX. dialtest reads the file of rules specified on the command line and then prompts for a dial string. For each string typed in, dialtest prints the result of applying the canonicalization and dial-string preparation rule sets. A rule set whose name is setname can be specified by typing ``set- name(string)''; for example, ``CanonicalName(+1.415.965.7824)''. Note that dialtest reads the rules file only when it is initially started up. This means that dialtest must be restarted for it to apply changes to a rules file. OPTIONS
-a code Use code as the value of AreaCode in the rules file. The default area code is ``415''. -c code Use code as the value of CountryCode in the rules file. The default country code is ``1''. -i prefix Use prefix as the value of InternationalPrefix in the rules file. The default international dialing prefix is ``011''. -l prefix Use prefix as the value of LongDistancePrefix in the rules file. The default long distance dialing prefix is ``1''. -q Be quiet, suppressing most all output except for the actual results. This is useful for using dialtest in an automated fashion. -v Print each input line before displaying the results of applying the dial string rules to the input string. This can be useful, for example, in shell scripts. SEE ALSO
dialrules(5) March 3, 1995 DIALTEST(8)
All times are GMT -4. The time now is 08:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy