Sponsored Content
Full Discussion: Help!! manipulating file
Top Forums UNIX for Dummies Questions & Answers Help!! manipulating file Post 302215547 by sirrtuan on Wednesday 16th of July 2008 04:41:59 PM
Old 07-16-2008
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:INSUPDSmilieELETE:" /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..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Manipulating output file

I have a file containing two fields, Name and Time, with about 57 lines in this file. I am struggling to create a loop that will cut out the first ten lines of this file and echo it to the screen. Can anybody help me please. (1 Reply)
Discussion started by: mariner
1 Replies

2. Shell Programming and Scripting

Manipulating a text file

hey guys, need ur expert help. m a core banker got stuck in someting techie and cant find a solution have manged to extract a file from oracle apps in a format that looks something like this... REC- A b c d x INV- A b... (6 Replies)
Discussion started by: komalkg
6 Replies

3. Solaris

Manipulating File

Help...please. I have a log that contains Warning Authentication Failed: User GHDT88998HS doesn't exit: The User GHDT88998HS could not be found Mar 22, 2008 5:22:22AM com.hometel.ttm.auth.userlogin. about maybe a thousand entries failed user acct message How can I grab just the username... (2 Replies)
Discussion started by: rivendell500
2 Replies

4. Shell Programming and Scripting

parsing a file and manipulating the contents

Hi I have a text file as follows BOB 14/14 TOM 94/94 SAM 3/3 CRIS 13/13 TOM 6/6 CRIS 27/27 SAM 2/2 JACK 25/25 CRIS (6 Replies)
Discussion started by: shellignorant
6 Replies

5. Shell Programming and Scripting

Manipulating the etc/passwd file with sed

How can i use sed to extract the user name and home directory from the /etc/passwd/ file on my server. (11 Replies)
Discussion started by: Pauline mugisha
11 Replies

6. Shell Programming and Scripting

Manipulating a file

Hi everybody, I need an urgent help with a BASH script. I have file which contains (besides the other data) the lines with the following structure identified by with keyword PCList: <PARAMETER NAME="PCList" TYPE="LIST_STRUCTURE" MODEL="{,}" ... (1 Reply)
Discussion started by: sameucho
1 Replies

7. Shell Programming and Scripting

Help Manipulating Large Csv File

Hello everyone, I am trying to manipulate a large .csv file where I have output similar to the following - http://imgur.com/TEXD8.png The result that I am looking for would be to consolidate the first column, but combine the second and third column so it still relates to the first. I... (8 Replies)
Discussion started by: xxwohxx
8 Replies

8. Shell Programming and Scripting

Manipulating csv file

We need to convert a field in a csv file which is in cents to dollars.(divide by 100) in our shell script. Can some body help me? (3 Replies)
Discussion started by: Deepthz
3 Replies

9. Shell Programming and Scripting

need help on manipulating a file

Hi, I need a shell/command to achieve this task. I've a delimited unloaded file from oracle in a scrambled format as shown below with many blank lines in it, I'm just trying to tailor it in a format that would be compatible to view and load it to a IDS db. Here is the problem ... (1 Reply)
Discussion started by: divak
1 Replies

10. Shell Programming and Scripting

Manipulating column in a file in UNIX

Hi I have a file content.txt where I want to replace the value of second column of the file with half of the value of that column. I only have to replace if the second column starts with COM_, rest all values have to be same eg, cat content.txt |COM_A|123|JHV|8475 |ABC|2765|BV|876... (7 Replies)
Discussion started by: infyanurag
7 Replies
SET 
CONSTRAINTS(7) SQL Commands SET CONSTRAINTS(7) NAME
SET CONSTRAINTS - set the constraint mode of the current transaction SYNOPSIS
SET CONSTRAINTS { ALL | constraint [, ...] } { DEFERRED | IMMEDIATE } DESCRIPTION
SET CONSTRAINTS sets the behavior of constraint evaluation in the current transaction. In IMMEDIATE mode, constraints are checked at the end of each statement. In DEFERRED mode, constraints are not checked until transaction commit. Note: This command only alters the behavior of constraints within the current transaction. Thus, if you execute this command outside of an explicit transaction block (such as one started with BEGIN), it will not appear to have any effect. If you wish to change the behavior of a constraint without needing to issue a SET CONSTRAINTS command in every transaction, specify INITIALLY DEFERRED or INI- TIALLY IMMEDIATE when you create the constraint. When you change the mode of a constraint to be IMMEDIATE , the new constraint mode takes effect retroactively: any outstanding data modifi- cations that would have been checked at the end of the transaction (when using DEFERRED) are instead checked during the execution of the SET CONSTRAINTS command. Upon creation, a constraint is always give one of three characteristics: INITIALLY DEFERRED, INITIALLY IMMEDIATE DEFERRABLE, or INITIALLY IMMEDIATE NOT DEFERRABLE. The third class is not affected by the SET CONSTRAINTS command. Currently, only foreign key constraints are affected by this setting. Check and unique constraints are always effectively initially immedi- ate not deferrable. COMPATIBILITY
SQL92, SQL99 SET CONSTRAINTS is defined in SQL92 and SQL99. The implementation in PostgreSQL complies with the behavior defined in the standard, except for the PostgreSQL limitation that SET CONSTRAINTS cannot be applied to check or unique constraints. SQL - Language Statements 2002-11-22 SET CONSTRAINTS(7)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy