Extracting data from file-shell scripting--please help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting data from file-shell scripting--please help
# 15  
Old 11-04-2011
@itkamarj

no this (nawk '/^[0-9][0-9][0-9] /' in.txt) is not working
Smilie

please look at the reply which i have posted to ahamed with my actual file!

Last edited by Scott; 11-04-2011 at 05:28 AM.. Reason: Code tags
# 16  
Old 11-04-2011
Code:
 
$ nawk '/^[0-9][0-9][0-9] /' test
153 | EOB, WED 10/19/11 | EOB, FRI 10/21/11 | asded
154 | EOB, WED 10/26/11 | EOB, THU 10/27/11 | Only
155 | EOB, TUE 11/08/11 | EOB, TUE 11/15/11 | Guide
157 | EOB, FRI 12/02/11 | EOB, THU 12/08/11 | Only

$ cat test 
1_52 | EOB, TUE 10/11/11 | EOB, MON 10/17/11 | asded
153 | EOB, WED 10/19/11 | EOB, FRI 10/21/11 | asded
{color:#ff0000}\********\*{color} | {color:#ff0000}Code{color} | {color:#ff0000}Freeze{color} | {color:#ff0000}\********************\*{color}
154 | EOB, WED 10/26/11 | EOB, THU 10/27/11 | Only
154_3 \\ | NOON, THURS 11/3/11 \\ | N/A \\ | Planned 
154_4 \\ | NOON, Fri 11/4/11 \\ | N/A \\ | Planned 
155 | EOB, TUE 11/08/11 | EOB, TUE 11/15/11 | Guide
1_56 | EOB, WED 11/23/11 | EOB, WED 11/30/11 | Only
157 | EOB, FRI 12/02/11 | EOB, THU 12/08/11 | Only

use code tag to post your sample input and data

The UNIX and Linux Forums - BB Code List
# 17  
Old 11-04-2011
Smilie

This is also not working

I am working on Solaris box
can this effect???
# 18  
Old 11-04-2011
yes.. i tested in solaris box only.
# 19  
Old 11-04-2011
not able to understand what is going on!!!

how it is giving the output in your machine and why not in my machine!
Even i have given you the exact file which i am having
SmilieSmilie
# 20  
Old 11-04-2011
can you attach the original file here. always please use the code tag, while you post the sample data
This User Gave Thanks to itkamaraj For This Post:
# 21  
Old 11-04-2011
hi itkamaraj

i have got the required output
i just deleted ^ symbol from the code give by you and i got the result.

Thank you so much for your help. SmilieSmilieSmilieSmilieSmilieSmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

3. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

4. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

5. Shell Programming and Scripting

Replace data of a file with data from another file using shell scripting.

Dears, I'm new to shell scripting and i was wondering if you can help me with following matter. I have a file containing 400,000 records. The file contains two columns like: 00611291,0270404000005453 25262597,1580401000016155 25779812,1700403000001786 00388934,1200408000000880... (1 Reply)
Discussion started by: paniklas
1 Replies

6. Shell Programming and Scripting

Shell scripting to extract data from file

Hi, i want to fetch the data from the alert log file, for a particular time interval. Example : Alert log content : Thu Mar 18 08:47:36 2010 Completed: alter database open Thu Mar 18 19:13:38 2010 MMNL absent for 6390 secs; Foregrounds taking over Fri Mar 19 08:30:52 2010... (1 Reply)
Discussion started by: Pinki018
1 Replies

7. UNIX for Dummies Questions & Answers

How to cut data block from .txt file in shell scripting

Hi All, Currently i have to write a script. For which i need to cut a block from .txt file. I know the specific word that starts the block and ends the block. Can we do it in shell scripting..? Please suggest.... (6 Replies)
Discussion started by: pank29
6 Replies

8. Shell Programming and Scripting

urgent-extracting block data from flat file using shell script

Hi, I want to extract block of data from flat file. the data will be like this start of log One two three end of log i want all data between start of log to end of log i.e One two three to be copied to another file. This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies
Login or Register to Ask a Question