Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Finding & Replacing specific Fields Post 302276853 by ddraj2015 on Wednesday 14th of January 2009 08:36:19 PM
Old 01-14-2009
Finding & Replacing specific Fields

All

I have a very large file (aproximately 150,000) as shown below separated by pipe "|". I need to replace data in 2, 16, 17, 23 fields that are of time stamp format. My goal is to look in those fields and it ends with "000000|" then replace it with "000|". In other words, make it as 6 digit micro second value. Some of the records may not end with "000000|". In that case, I shouldn't replace that value. I am enclosing couple of sample records.

Record 1)

154842|2007-11-15 09:33:28.540000000|126074|||02|ALLEN|
DEBORAH|G||2006-06-19 00:00:00|U78BA5|||T|2007-11-15 09:33:28.540000000|2007-11-14 00:00:00|O|O|O|O| |19
00-01-01 00:00:00|2|N/A|DEALLEN

Record 2)

72421|2005-10-07 11:24:00|114307| N/A|Z125A|02|HOLLIS|MENDEZ|D||2005-10-08 00:00:00|U20AWX||64602|A|2005-10-08 00:00:00|2005-11-16 00:00:00|A|A|A|A| |2005-10-0
8 00:00:00|1|Z125|MEHOLLIS

Thanks a lot,
Sekhar
 

10 More Discussions You Might Find Interesting

1. Solaris

finding & replacing blank rows/spaces in a file

Can anyone help me find and replace blank rows in a file with a numeric value (ie blankrow=someTxtOrNumValue), the file is over 500,000 rows long so it would need to be the quickest way as I'll need to do this for multiple files...I would be greatfull for any suggestions....thanks sample file:... (2 Replies)
Discussion started by: Gerry405
2 Replies

2. Shell Programming and Scripting

Replacing Last occurance of & from a string

Hi All, Could anyone help me out in the below requirement: I have a text(XML) file like this: - <Dim2> <Properties Name="" State="2" ShowHir="-1" ApplyFilter="-1" ExpandToLevel="1" BreakHierType="1" MaxDepth="1" SlicerSelectOptions="1" ShowLeaf="0" HasGroup="0" /> <Expanded... (1 Reply)
Discussion started by: vivekshady
1 Replies

3. Shell Programming and Scripting

help with finding & replacing pattern in a file

Hi everyone. Could u be so kind and help me with on "simple" shell script? 1. i need to search a file line by line for a pattern. example of a lines in that file 2947 domain = feD,id = 00 0A 02 48 17 1E 1D 39 DE 00 0E 00,Name Values:snNo = f10 Add AttFlag = 0 2. i need to find... (0 Replies)
Discussion started by: dusoo
0 Replies

4. Shell Programming and Scripting

Specifying and replacing fields with awk

#cat BATCH007.TXT 01,661060052,061000104,081118,0915,07,80,1,2/ 99,,,2/ I have this file called BATCH007.TXT. I am trying to change fields 2 and 3 on line 2 to have zeroes. Like this: 01,661060052,061000104,081118,0915,07,80,1,2/ 99,0,0,2/ I can use these commands to print identify the... (2 Replies)
Discussion started by: ddurden7
2 Replies

5. Shell Programming and Scripting

Replacing fields

Hi! I have a file somefile.txt: 12, 1, a, b, c, d, e, f 12, 1, a, b, c, d, e, f 17, 51, a, b, c, d, e, f ... I've made this script to read two fields from a line and output a third: cat somefile.txt | awk -F, '{if ($1 == "12" && $2== "1") print "19"; else if ($1 == "17" && $2== "51")... (8 Replies)
Discussion started by: Tr0cken
8 Replies

6. Shell Programming and Scripting

Replacing certain fields from certain rows

Hi all, say for example i have the next input file 30 Au 7.500000 7.500000 5.774000 Au 7.500000 8.995000 8.363000 Au 7.500000 6.005000 8.363000 Au 20.633000 7.500000 9.226000 Au 20.632000 6.005000 6.637000 Au 20.632000 ... (4 Replies)
Discussion started by: ezitoc
4 Replies

7. Shell Programming and Scripting

sort & uniq on specific fields problem

Hello; I have the output data set from: egrep -i 'warning| error| fail' /var/adm/syslog/syslog.log Jan 31 12:02:18 fidsrv vmunix: LVM: WARNING: VG 128 0x001000: LV 5: Some I/O requests to this LV are waiting Jan 31 12:02:23 fidsrv vmunix: Asynchronous write failed on LUN (dev=0x100000f)... (3 Replies)
Discussion started by: delphys
3 Replies

8. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

9. Shell Programming and Scripting

Swapping/replacing fields

Hallo Team, I would like to replace filed 4 and 7 with filed 39 how can i achieve this ? -bash-3.2$ cat dip1.csv| cut -f4,7,24,36,39 -d","|sort -u +27113996891,+27113996891,196.35.130.52,828854047,+27873500077 +27116452690,+27825702918,10.0.109.13:5060,+27116452690,+27116452690... (2 Replies)
Discussion started by: kekanap
2 Replies

10. Shell Programming and Scripting

Replacing entire fields with specific text at end or beginning of field

Greetings. I've got a csv file with data along these lines: Spumoni's Pizza Place, Placemats n Things, Just Lamps Counterfeit Dollars by Vinnie, Just Shades, Dollar StoreI want to replace the entire comma-delimited field if it matches something ending in "Place" or beginning with "Dollar",... (2 Replies)
Discussion started by: palmfrond
2 Replies
uuagc(1)							   User Commands							  uuagc(1)

NAME
uuagc - Attribute Grammar compiler SYNOPSIS
uuagc [ options ... ] file DESCRIPTION
This program uuagc is the compiler of the (Utrecht University) Attribute Grammar system. It takes as input AG source files (.ag) and pro- duces as output regular Haskell source files (.hs). Available options: -m generate default module header --module[=name] generate module header, specify module name -d, --data generate data type definition --strictdata generate strict data fields (when data is generated) --strictwrap generate strict wrap fields for WRAPPER generated data -c, --catas generate catamorphisms -f, --semfuns generate semantic functions -s, --signatures generate signatures for semantic functions --newtypes use newtypes instead of type synonyms -p, --pretty generate pretty printed list of attributes -w, --wrappers generate wappers for semantic domains -r, --rename rename data constructors --modcopy use modified copy rule --nest use nested tuples --syntaxmacro experimental: generate syntax macro code (using knit catas) -o file, --output=file specify output file -v, --verbose verbose error message format -h, -?, --help get usage information -a, --all do everything (-dcfsprm) -P search path, --=search path specify seach path --prefix=prefix set prefix for semantic functions --self generate self attribute --cycle check for cyclic definitions --version get version information -O,--optimize optimize generated code (--visit --case) --visit try generating visit functions --seq force evaluation using function seq (visit functions only) --unbox use unboxed tuples --case use nested cases instead of let (visit functions only) --Werrors turn warnings into fatal errors --dumpgrammar dump internal grammar representation (in generated code) COPYRIGHT
Copyright (C) 1998 -- 2005 Doaitse Swierstra, Arthur Baars and Alexey Rodriguez Copyright (C) 2005 -- 2007 Alexey Rodriguez Copyright (C) 2005 -- 2007 Joost Verhoog Copyright (C) 2006 -- 2007 Arie Middelkoop Copyright (C) 2006 -- 2007 Jeroen Fokker Copyright (C) 2007 Atze Dijkstra This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA AUTHOR
This manual page was written by Arjan Oosting <arjanoosting@home.nl> for the Debian system (but may be used by others). uuagc 0.9.4 April 2007 uuagc(1)
All times are GMT -4. The time now is 01:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy