![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Specifying and replacing fields with awk | ddurden7 | Shell Programming and Scripting | 2 | 11-19-2008 04:28 AM |
| Need help in finding and replacing port numbers. | ankushsingh10 | Shell Programming and Scripting | 3 | 10-01-2008 02:05 PM |
| help with finding & replacing pattern in a file | dusoo | Shell Programming and Scripting | 0 | 05-23-2008 04:59 AM |
| Finding nth occurrence in line and replacing it | stresing | UNIX for Dummies Questions & Answers | 5 | 02-01-2008 04:56 AM |
| shellscript for finding and replacing in DG-UNIX | Gerry405 | UNIX for Dummies Questions & Answers | 3 | 07-12-2005 09:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
Ygor:
Thanks for response. It did work. Would you please tell me how it all came together? Especially at \....000\)000/\1. Please let me know this would give us in what we need. Thanks ahead for the help. It really helped me. sed 's/\(|....-..-.. ..:..:..\....000\)000/\1/g' file1 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|