10-07-2009
Help in writing a find/replace script using awk
Hi All,
I need to write a script that will go through 600+ files and perform find and replace. I was going to use sed but there is a level of complexity that is doing my head in.
To explain: I have 600+ files that have a line in them that reads (for example)
FILE=DCLCLHST
REMARKS='CLAIM_HISTORY' $
SEGNAME=DCLCHST, SEGTYPE=SO
--Followed by anothe 50 lines or so---
In the line REMARKS='CLAIM_HISTORY' $ the $ is supposed to have a , in front so it reads REMARKS='CLAIM_HISTORY' ,$
I have played around with awk and came up with awk '/REMARKS/{if ($2=="$") $2=",$"; print > FILENAME}' *.mas
Of course the problem here is that the entire file gets over written and only the REMARKS line (correct mind you) exists within the file.
So I guess the question is how can I perform a find and replace on the $ only on the line that contains the word REMARKS without overwriting the rest of the file. Thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi to all
i have file like this
file.txt
this is naryana expect
hyderabad is a cool place
now climate VISAKHSAPATNAM became very cool
#vizag is my birth place
#hyderabad is a cool place
#now climate of hyd became very cool
#vizag is my birth place
#hyderabad is a cool place ... (7 Replies)
Discussion started by: LAKSHMI NARAYAN
7 Replies
2. Shell Programming and Scripting
hi buddies
pls help in this matter
i have file like this input file
--------------------------
(PARTITION PARTITION_1 VALUES LESS THAN (101, 16383 ) TABLESPACE PART_1
,PARTITION PARTITION_2 VALUES LESS THAN (101, 32766 ) TABLESPACE PART_2
,PARTITION PARTITION_3 VALUES LESS THAN (101,... (3 Replies)
Discussion started by: LAKSHMI NARAYAN
3 Replies
3. UNIX for Dummies Questions & Answers
I just started learning about Unix and I cant figure out what im doing wrong. I'm trying to write a script that will ask for the file name and tell what type it is. This is what i have so far.
http://i63.photobucket.com/albums/h123/wacand/untitled.jpg (2 Replies)
Discussion started by: wacand
2 Replies
4. Shell Programming and Scripting
Hi,
I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies
5. Shell Programming and Scripting
hello all!
well, here is my problem:
i have to write a script which waits for a directory as an argument and scans it recuresively and than it prints those files, which have write permission for everyone (as relative path from the argument directory so the find will be the key). and it shouldnt... (9 Replies)
Discussion started by: Mixe3y
9 Replies
6. UNIX for Dummies Questions & Answers
%%%%% (7 Replies)
Discussion started by: lucasvs
7 Replies
7. Shell Programming and Scripting
Hi,
I thought I am getting pretty good with sed and awk, but now I dont have a way out of this question.
I have a table 0.5 16
1.3 14
0.25 15
0.85 16
I want to make a column 3 which contains values that are (corresponding $2 value/sum of all $2).
Please help me out here.
Thanks. (6 Replies)
Discussion started by: jamie_123
6 Replies
8. Shell Programming and Scripting
Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated
If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding... (4 Replies)
Discussion started by: as7951
4 Replies
9. UNIX for Beginners Questions & Answers
I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
Discussion started by: Kunalcurious
10 Replies
10. Shell Programming and Scripting
Hello,
I have some code that works more or less. This is called by a make file to adjust some hard-coded definitions in the src code. The script generated some values by looking at some of the src files and then writes those values to specific locations in other files. The awk code is used to... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
LEARN ABOUT CENTOS
ldns_key_new_frm_fp_dsa_l
ldns(3) Library Functions Manual ldns(3)
NAME
ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l
SYNOPSIS
#include <stdint.h>
#include <stdbool.h>
#include <ldns/ldns.h>
DSA* ldns_key_new_frm_fp_dsa(FILE *fp);
DSA* ldns_key_new_frm_fp_dsa_l(FILE *fp, int *line_nr);
DESCRIPTION
ldns_key_new_frm_fp_dsa() frm_fp helper function. This function parses the remainder of the (DSA) priv. key file
fp: the file to parse
Returns NULL on failure otherwise a RSA structure
ldns_key_new_frm_fp_dsa_l() frm_fp helper function. This function parses the remainder of the (DSA) priv. key file
fp: the file to parse
line_nr: pointer to an integer containing the current line number (for debugging purposes)
Returns NULL on failure otherwise a RSA structure
AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben.
REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html
COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs.
Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
ldns_key_new_frm_fp, ldns_key. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035.
REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl.
30 May 2006 ldns(3)