Sponsored Content
Top Forums Shell Programming and Scripting help with search and replace in multiple fields Post 302435912 by dsravan on Thursday 8th of July 2010 01:42:07 PM
Old 07-08-2010
scottn,

I am getting below error with your command

Quote:
-ksh: syntax error: `(' unexpected


---------- Post updated at 01:42 PM ---------- Previous update was at 01:40 PM ----------

got it. figured out

Quote:
awk 'BEGIN { OFS=FS="|" } function GSUB( F ) { gsub( ",", "", $F ) } { GSUB( 25 ); GSUB( 26 ); GSUB( 27 ) } 1' file
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Multiple search and replace

Hi, I have different files and I want to automatically change the values of the defined variables. i want to get rid of editing all the files and make it a little bit faster. my problem is like this. 1. i will input all the new values. 2. substitute this values into the values inside the... (1 Reply)
Discussion started by: tungaw2004
1 Replies

2. UNIX for Dummies Questions & Answers

search and replace different fields

Hi i want to search and replace different field on each files. file 1 FIELD2=xxxxxxxxx FIELD4=xxxxxxxx FIELD3=xxxxxxx FIELD1=20000 file 2 FIELD1= FIELD2= file 3 FIELD2=xxxxxxxxx (3 Replies)
Discussion started by: tungaw2004
3 Replies

3. UNIX for Dummies Questions & Answers

multiple input search and replace script

hi, i want to create a script that will search and replace the values inside a particular file. i have 5 files that i need to change some values inside and i don't want to use vi to edit these files. All the inputted values on the script below will be passed into the files. cho "" echo... (3 Replies)
Discussion started by: tungaw2004
3 Replies

4. Shell Programming and Scripting

Search & replace fields from file1 to file2

hi, I have two xml files with the name source.xml and tobe_replaced.xml. Sample data: source.xml contains: <?xml version="1.0"?> <product description="prod1" product_info="some/info"> <product description="prod2" product_info="xyz/allinfo"> <product description="abc/partialinfo"... (2 Replies)
Discussion started by: dragon.1431
2 Replies

5. Shell Programming and Scripting

Find and Replace in multiple fields using awk

Hi, Say I have a record "1|22| | |". In which the third and fourth fields are <space> alone. I have to replace the <Space> with <null>. Input: "1|22| | |" --> "1|22|<space> |<space> |" Expected output: "1|22|||" --> "1|22|<null> |<null>|" I tried: echo "1|22| | |" | awk -F... (4 Replies)
Discussion started by: machomaddy
4 Replies

6. Shell Programming and Scripting

perl: search replace in multiple files

When I use special characters the command to replace multiple files with a string pattern does nt work. ---------- Post updated at 12:33 PM ---------- Previous update was at 11:38 AM ---------- This works perl -pi -e 's/100/test/g' * This does nt work perl -pi -e 's... (1 Reply)
Discussion started by: w020637
1 Replies

7. Shell Programming and Scripting

Search & Replace: Multiple Strings / Multiple Files

I have a list of files all over a file system e.g. /home/1/foo/bar.x /www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g. if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc. There... (2 Replies)
Discussion started by: spacegoose
2 Replies

8. Shell Programming and Scripting

Perl search multiple fields

Hi all, I have a flatfile 300 lines tiger,tampa10-pc,yellow,none,2013-02-25 08:56:51.000,2013-02-25 21:41:11.380,12hrs : 44min cat,tampa10-pc,white,none,2013-02-28 08:56:58.000,2013-03-04 23:18:23.003,110hrs : 21min dog,tampa10-pc,yellow,none,2013-03-05 09:50:17.000,2013-03-07... (5 Replies)
Discussion started by: sabercats
5 Replies

9. Shell Programming and Scripting

Search and Replace in multiple files

Hello, I have hundreds of files in which I need to change email address. Here is what I am trying to do: 1. All text files are in a directory "a" 2. In the text file, I want to replace email address for preparer. All these lines start with {{PreparerEmail and end with }}. The email... (3 Replies)
Discussion started by: cartrider
3 Replies

10. Shell Programming and Scripting

Replace 0 with 1 in multiple fields with awk

Hello, I have the following input file: 1 3 3 2 3 3 4 0 4 0 5 4 5 2 2 0 5 3 4 0 6 0 3 2 I am trying to remove all zeroes in fields 2 and 4 and replace them with "1's" I tried the following, but it's not working awk -F"\t" '{ if (($2==0) || ($4==0) $2=1; $4=1; print $0 ) }' input ... (8 Replies)
Discussion started by: Rabu
8 Replies
Font::TTF::GSUB(3pm)					User Contributed Perl Documentation				      Font::TTF::GSUB(3pm)

NAME
Font::TTF::GSUB - Module support for the GSUB table in conjunction with TTOpen DESCRIPTION
Handles the GSUB subtables in relation to Ttopen tables. Due to the variety of different lookup types, the data structures are not all that straightforward, although I have tried to make life easy for myself when using this! INSTANCE VARIABLES
The structure of a GSUB table is the same as that given in Font::TTF::Ttopen. Here we give some of the semantics specific to GSUB lookups. ACTION_TYPE This is a string taking one of 4 values indicating the nature of the information in the ACTION array of the rule: g The action contains a string of glyphs to replace the match string by l The action array contains a list of offsets and lookups to run, in order, on the matched string a The action array is an unordered set of optional replacements for the matched glyph. The application should make the selection somehow. o The action array is empty (in fact there is no rule array for this type of rule) and the ADJUST value should be added to the glyph id to find the replacement glyph id value MATCH_TYPE This indicates which type of information the various MATCH arrays (MATCH, PRE, POST) hold in the rule: g The array holds a string of glyph ids which should match exactly c The array holds a sequence of class definitions which each glyph should correspondingly match to o The array holds offsets to coverage tables CORRESPONDANCE TO LAYOUT TYPES
The following table gives the values for ACTION_TYPE and MATCH_TYPE for each of the 11 different lookup types found in the GSUB table definition I have: 1.1 1.2 2 3 4 5.1 5.2 5.3 6.1 6.2 6.3 ACTION_TYPE o g g a g l l l l l l MATCH_TYPE g g c o g c o Hopefully, the rest of the uses of the variables should make sense from this table. METHODS
$t->read_sub($fh, $lookup, $index) Asked by the superclass to read in from the given file the indexth subtable from lookup number lookup. The file is positioned ready for the read. $t->extension Returns the table type number for the extension table $t->out_sub($fh, $lookup, $index) Passed the filehandle to output to, suitably positioned, the lookup and subtable index, this function outputs the subtable to $fh at that point. AUTHOR
Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright and licensing. perl v5.10.1 2009-06-06 Font::TTF::GSUB(3pm)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy