The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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
editing ELF file tejuwala Linux 1 05-18-2008 12:22 AM
How to editing a txt file aaabbb123123 Shell Programming and Scripting 3 03-07-2008 12:31 AM
Editing file rahul303 Shell Programming and Scripting 4 09-23-2007 11:49 PM
Editing File using awk/sed Mohammed Shell Programming and Scripting 4 05-16-2007 12:00 PM
File editing using awk rinku11 Shell Programming and Scripting 2 11-23-2006 11:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-16-2008
srinivas.maddy srinivas.maddy is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 8
Pls help me with file editing using awk

Hi all,
Pls help me with file editing using awk.
I have a text file with the below format.

"STANDARD VOLUME ","2009","BUX","V","JCBH49","NF", 001413
"VENDOR MATERIAL-STD ","2009","BUX","V","JCBH49","NF", 009948
"INBOUND TRANS-STD ","2009","BUX","V","JCBH49","NF", 000264
"DIRECT LABOR-STD ","2009","BUX","V","JCBH49","NF", 000010
"VARIABLE BURDEN-STD ","2009","BUX","V","JCBH49","NF", 000062
"FIXED BURDEN-STD ","2009","BUX","V","JCBH49","NF", 000081

Here I want to retrieve the records of only "VENDOR MATERIAL-STD "and write to another text file. Also I want to replace "V" with “Prod Matl Cost PU Base Vehicle” and "O" with “Prod Matl Cost PU Avg Option” while writing to another file.

Thanks in advance.
  #2 (permalink)  
Old 09-16-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
try:
Code:
sed -n -e '/VENDOR MATERIAL-STD/ { s/"V"/Prod Matl Cost PU Base Vehicle”/ ; s/"O"/“Prod Matl Cost PU Avg Option”/ ; p }' filename > newfile
  #3 (permalink)  
Old 09-16-2008
srinivas.maddy srinivas.maddy is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 8
Thanks Yogesh.

I tried the below and got the below message.

#!/bin/ksh
sed -n -e '/VENDOR MATERIAL-STD / { s/"V"/Prod Matl Cost PU Base Vehicle./ ; s/"O"/.Prod Matl Cost PU Avg Optio
n./ ; p }' /clocal/fme/essbase/data/cash/goldbooklesspowertrain.txt > /clocal/fme/essbase/data/cash/newgoldbooklesspowertrain.
txt

Message:

sed: command garbled: /VENDOR MATERIAL-STD / { s/"V"/Prod Matl Cost PU Base Vehicle./ ; s/"O"/.Prod Matl Cost PU Avg Option./ ; p }
Closed Thread

Bookmarks

Tags
sed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0