![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flat File in HP-UX | Krishnaramjis | Shell Programming and Scripting | 0 | 06-02-2008 11:24 PM |
| Help with a Flat File!!! | kumarsaravana_s | Shell Programming and Scripting | 11 | 06-07-2007 11:15 PM |
| Help with a flat file!!! | kumarsaravana_s | Shell Programming and Scripting | 3 | 04-16-2007 07:58 AM |
| XML to flat file | balireddy_77 | Shell Programming and Scripting | 2 | 04-13-2007 05:57 AM |
| Converting Pivot file to flat file | vskr72 | Shell Programming and Scripting | 2 | 10-18-2005 04:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Flat file
Hi
I have a flat file looking this QWER 2:35 7044 00001 ROUT 1188 EA SS ASD 2:36 7044 00010 ROUT BSD 2:37 7044 00011 ROUT END QWER 3:35 7044 00011 ROUT 1088 EA SS ASD 3:36 7044 00010 ROUT BSD 3:37 7044 00011 ROUT END If the redcolor value is 1088 then i need to change the values in the 3rd column (ie., 7044) to 9999 . How do i do script in HP -UX Thanks Krishna |
|
||||
|
How about this?
Code:
awk '
# if the QWER line contains 1088, set the change flag to true
$1=="QWER" { if ($6==1088) { change=1 } else { change=0 } }
# if the change flag is set and the line has more than 3 fields, override the 3rd value
change && NF > 3 { $3=9999 }
# print the line
1
' inputfile
|
|
||||
|
Quote:
Code:
sed '/1188/s/7044/9999/g' filename |
|
||||
|
thanks alls. But Let me tell my requiremnet one more time .
QWER 2:35 7044 00001 ROUT 1188 EA SS ASD 2:36 7044 00010 ROUT BSD 2:37 7044 00011 ROUT END QWER 3:35 7044 00011 ROUT 1088 EA SS ASD 3:36 sed '/1188/s/7044/9999/g' 00010 ROUT BSD 3:37 7044 00011 ROUT END If the redcolor value is 1088 then i need to change the values in the 3rd column (ie., 7044) to 9999 . How do i do script in HP -UX I want output as QWER 2:35 7044 00001 ROUT 1188 EA SS ASD 2:36 7044 00010 ROUT BSD 2:37 7044 00011 ROUT END QWER 3:35 1088 00011 ROUT 1088 EA SS ASD 3:36 1088 00010 ROUT BSD 3:37 1088 00011 ROUT END Thanks Krishna |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|