![]() |
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 |
| reading ,writing,appending ,manipulating a file. | szchmaltz | UNIX for Dummies Questions & Answers | 4 | 06-17-2008 03:02 AM |
| Manipulating a fixed length file w/o PERL | dabear | Shell Programming and Scripting | 4 | 03-31-2008 05:33 PM |
| Manipulating File | rivendell500 | SUN Solaris | 2 | 03-25-2008 10:52 PM |
| Manipulating a text file | komalkg | Shell Programming and Scripting | 6 | 06-24-2007 07:15 AM |
| Manipulating output file | mariner | UNIX for Advanced & Expert Users | 1 | 04-20-2005 09:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help!! manipulating file
Hi all,
I need help manipulating the file below. Here is what I needed to do. First, I have to replace INSUPD to DELETE. Then I need to change the content of the file around by flipping the contents in the file from the bottom to the top (start from "CMD") How should I attack this? Here is the original file. SET DECIMAL , SET DATAFORMAT DELIMITED SET SEPARATOR ~ SET PREFIX DATA NONE SET QUOTE NONE SET DATEFORMAT DD-MM-YYYY CMD INSUPD format ATT code nature_e INC /usr/tmp/FORMAT.fmt CMD INSUPD format_element ATT sqlname_c INC /usr/tmp/FORMAT.elt CMD INSUPD denomination format_element ATT object_id INC /usr/tmp/FORMAT.feden CMD INSUPD script_definition ATT attribute.sqlname_c INC /usr/tmp/FORMAT.def Here is what I want it to be. SET DECIMAL , SET DATAFORMAT DELIMITED SET SEPARATOR ~ SET PREFIX DATA NONE SET QUOTE NONE SET DATEFORMAT DD-MM-YYYY CMD INSUPD script_definition ATT attribute.sqlname_c INC /usr/tmp/FORMAT.def CMD INSUPD denomination format_element ATT object_id INC /usr/tmp/FORMAT.feden CMD INSUPD format_element ATT sqlname_c INC /usr/tmp/FORMAT.elt CMD INSUPD format ATT code nature_e INC /usr/tmp/FORMAT.fmt Here is what I got so far. #/bin/ksh # Replacing INSUPD with DELETE /bin/sed -e "s:INSUPD ELETE:" /usr/tmp/XYZ_FILE.cmd | awk '{print};/INC .*.del/{exit}' > /usr/tmp/ XYZ_FILE.del.cmd#end script Last edited by sirrtuan; 07-16-2008 at 06:37 PM.. |
|
||||
|
I want to move section 1 to 3 and via versa.
Here is an example: 1) CMD INSUPD format ATT code nature_e INC /usr/tmp/FORMAT.fmt 2) CMD INSUPD format_element ATT sqlname_c INC /usr/tmp/FORMAT.elt 3) CMD INSUPD denomination format_element ATT object_id INC /usr/tmp/FORMAT.feden Last edited by sirrtuan; 07-16-2008 at 06:38 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|