Need command to parse data


 
Thread Tools Search this Thread
Operating Systems Solaris Need command to parse data
# 1  
Old 10-24-2013
Need command to parse data

Hi Friends,

I have data like below

Code:
t064266 [24/Oct/2013:10:44:52 /SASEnterpriseGRC/Director?busobjtype=actionPlan&saspfs_sessionrequest=e9a1da9b-0e42-1531-1267-13130a3ca73a&object_rk=36446&saspfs_sessionid=a6c6dcf4a471b359%3A5be677f2%3A141e98d8b8a%3A-33cf&subtype=SI&base_table=ACTION_PLAN&_directive=STPRun&includeDims=true&rk_column=action_plan_rk&_program=%2FUBS%2FStored%20Processes%2FChange%20History%20Report

I want output into this format
Code:
t064266 [24/Oct/2013:10:44:52 2FUBS%2FStored%20Processes%2FChange%20History%20Report

Data are space delimited and i want parse third column data.

Thanks

Last edited by jim mcnamara; 10-24-2013 at 09:51 AM.. Reason: code tags
# 2  
Old 10-24-2013
Code:
awk -F '[ =]' '{print $1,$2,$NF}' myFile

# 3  
Old 10-24-2013
I tried the command but that not giving desired output.

Also i tried this
Code:
sed 's/.*METASERVER\([^)]*\).*/\1/' | sed 's/F/ /g'

But its ignoring first two columns and printing third one only.
Code:
2 UBS%2 Stored%20Processes%2 Change%20History%20Report


Last edited by Franklin52; 10-24-2013 at 11:13 AM.. Reason: Please use code tags for data and code samples
# 4  
Old 10-24-2013
Quote:
Originally Posted by Jagaat
I tried the command but that not giving desired output.
this is not really helpful...
What ARE you getting?
# 5  
Old 10-24-2013
Your command returing whole line.

Its not changing anything.
# 6  
Old 10-24-2013
Code:
$ awk -F '[ =]' '{print $1,$2,$NF}' jag.txt
t064266 [24/Oct/2013:10:44:52 %2FUBS%2FStored%20Processes%2FChange%20History%20Report

where jag.txt contains
Code:
t064266 [24/Oct/2013:10:44:52 /SASEnterpriseGRC/Director?busobjtype=actionPlan&saspfs_sessionrequest=e9a1da9b-0e42-1531-1267-13130a3ca73a&object_rk=36446&saspfs_sessionid=a6c6dcf4a471b359%3A5be677f2%3A141e98d8b8a%3A-33cf&subtype=SI&base_table=ACTION_PLAN&_directive=STPRun&includeDims=true&rk_column=action_plan_rk&_program=%2FUBS%2FStored%20Processes%2FChange%20History%20Report

Validate what you've posted HERE is what you're working with.
# 7  
Old 10-24-2013
I ran the same command see the output

Code:
 
# cat jag.txt
t064266 [24/Oct/2013:10:44:52 /SASEnterpriseGRC/Director?busobjtype=actionPlan&saspfs_sessionrequest=e9a1da9b-0e42-1531-1267-13130a3ca73a&object_rk=36446&saspfs_sessionid=a6c6dcf4a471b359%3A5be677f2%3A141e98d8b8a%3A-33cf&subtype=SI&base_table=ACTION_PLAN&_directive=STPRun&includeDims=true&rk_column=action_plan_rk&_program=%2FUBS%2FStored%20Processes%2FChange%20History%20Report

Output

Code:
awk -F'[ =]' '{print $1,$2,$NF}' jag.txt

Output
Code:
 

t064266  24/Oct/2013:10:44:52 /SASEnterpriseGRC/Director?busobjtype=actionPlan&saspfs_sessionrequest=e9a1da9b-0e42-1531-1267-13130a3ca73a&object_rk=36446&saspfs_sessionid=a6c6dcf4a471b359%3A5be677f2%3A141e98d8b8a%3A-33cf&subtype=SI&base_table=ACTION_PLAN&_directive=STPRun&includeDims=true&rk_column=action_plan_rk&_program=%2FUBS%2FStored%20Processes%2FChange%20History%20Report 24/Oct/2013:10:44:52 /SASEnterpriseGRC/Director?busobjtype=actionPlan&saspfs_sessionrequest=e9a1da9b-0e42-1531-1267-13130a3ca73a&object_rk=36446&saspfs_sessionid=a6c6dcf4a471b359%3A5be677f2%3A141e98d8b8a%3A-33cf&subtype=SI&base_table=ACTION_PLAN&_directive=STPRun&includeDims=true&rk_column=action_plan_rk&_program=%2FUBS%2FStored%20Processes%2FChange%20History%20Report

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl :: to parse the data from a string.

Hi folks, I have a line in log from which I need to parse few data. Jul 6 00:05:58 dg01aipagnfe01p %FWSM-3-106011: Deny inbound (No xlate) From the above... I need to parse the %FWSM-3-106011: substring. Another example Jul 13 00:08:55 dq01aipaynas01p %FWSM-6-302010: 2 in use, 1661... (3 Replies)
Discussion started by: scriptscript
3 Replies

2. Shell Programming and Scripting

AWK script to parse a data in a file

Hi Unix gurus.. I have a file which has below data, It has several MQ Queue statistics; QueueName= 'TEST1' CreateDate= '2009-10-30' CreateTime= '13.45.40' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 0 QueueName= 'TEST2' CreateDate= '2009-10-30'... (6 Replies)
Discussion started by: dd_psg
6 Replies

3. Shell Programming and Scripting

Regex to Parse data

Experts and Informed folks, Need some help here in parsing the log file. 1389675 Opera_ShirtCatalog INSERT INTO Opera_ShirtCatalog(COL1, COL2) VALUES (1, 'TEST1'), (2,'TEST2'); 1389685 Opera_ShirtCatlog_Wom INSERT INTO Opera_ShirtCatlog_Wom(col1, col2, col3) VALUES (9,'Siz12, FormFit',... (12 Replies)
Discussion started by: ManoharMa
12 Replies

4. Shell Programming and Scripting

Parse data

Guys , please help me out with another AWK solution ... Input Device Physical Name : Not Visible Device Symmetrix Name : 0743 Front Director Paths (2): { ---------------------------------------------------------------------- ... (5 Replies)
Discussion started by: greycells
5 Replies

5. Shell Programming and Scripting

Parse data

hi i have a file p1.htm <div class="colorID2"> aaaa aaaa aa <br/> bbbbbbbb bbb<br/> <br/>cccc ccc ccc </div><div class="colorID1"> dddd d ddddd<br/> eeee eeee eeeeeeeeee<br/> fffff <br/>g gg<br/> (5 Replies)
Discussion started by: saw7
5 Replies

6. Shell Programming and Scripting

How to parse data?

Hi all, I have output of paction command looking like this: RELCI 0 IP address 1.2.16.3 Xmit: CURRENT Recv: WAIT_HEADER 0 congestions 2617/0 buf. sent/rec Xmit: CURRENT Recv: WAIT_HEADER 0 congestions 0/0 buf. sent/rec BUFFER Xmit: ... (6 Replies)
Discussion started by: sameucho
6 Replies

7. Shell Programming and Scripting

Extract and parse data between two strings

Hi , I have a billing CDR file which is separated by “!”. I need to extract and format data between the starting (“!”) and the end of the line (“1.2.1.8”). These two variables are permanent tags to show begin and end. ! TICKET NBR : 2 ! GSI : 101 ! 3100.2.112.1 24/03/2010 00:41:14 !... (3 Replies)
Discussion started by: jaygamini
3 Replies

8. Shell Programming and Scripting

parse data using sh script

Hi, I am a newbie to unix/shell scripting and i have a question on how to parse a txt file using perl in a sh script. I have a txt file that contains hundreds of lines with data like this.... X, Y, Latitude, Longitude 1, 142, -38.000000, -91.000000, 26.348 2, 142, 60.000000, -90.000000,... (2 Replies)
Discussion started by: moonbaby
2 Replies

9. UNIX for Dummies Questions & Answers

How to parse the specific data from the file

Hi, I need to parse this data FastEthernet0/9,|FastEthernet0/10,|FastEthernet0/11,FastEthernet0/13|, FastEthernet0/12,FastEthernet0/24 . and get only the value like e.g 0/24,0/11. how to do this in shell script. Thanks in Advance. (2 Replies)
Discussion started by: MuthuAlagappan
2 Replies

10. Shell Programming and Scripting

Parse a range of data

Hello, I have a file which has a range of date like: 00:00 test 00:01 test2 00:02 test3 00:03 test4 00:04 test5 00:05 test6 Using input (stdin) i would like to parse the data 00:01 to 00:04. The output file should be like this: 00:01 test2 00:02 test3 00:03 test4 00:04 test5 ... (5 Replies)
Discussion started by: BufferExploder
5 Replies
Login or Register to Ask a Question