cutting unwanted text


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cutting unwanted text
# 1  
Old 11-29-2006
cutting unwanted text

Hello,

I have a log file which looks like this :
Quote:
10-10-2006 08:44:45,802 [ some info here ] This is my Event : HTTP GET
10-10-2006 08:44:45,802 [ some info here ] Time duration: 1013 mls. (1 sec.)
I want to cut out some text and get printed only : "HTTP GET" and "Time duration: 1013 mls. (1 sec.)" I tried searching the forum for such solution, but I was unable to find it.
I also tried
Code:
 awk '/duration/ { print $0 }' mylogfile.log

, but this return the entire row of data. Please shed some light on this, thanks.
# 2  
Old 11-29-2006
Code:
awk -F": " '{ print $2 }' filename

check,
There is a space after :,
as per your input file patter
# 3  
Old 11-29-2006
thank you man, it works perfectly.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to change name of the file with first line of the file which has some unwanted text in it?

I have a log file, which i have divided into 14 files using csplit, the file looks like below test-000000 test-000001 #and so on until 14 now I want all the 14 files generated to be renamed as the some part of test in first line of the file how can i eliminate the unwanted text? sample... (5 Replies)
Discussion started by: Sekhar419
5 Replies

2. UNIX for Dummies Questions & Answers

Deleting unwanted text from a table

Hi everyone, I have a microbial diversity table in the format ;k__kingdom; p__phylum, etc, somer rows have descriptions before the :k__ (like the af028349.1 below) is there a way I can get rid of this text (which is different every time) and keep all the other columns? Thanks a bunch! ;... (1 Reply)
Discussion started by: Juan Gonzalez
1 Replies

3. Shell Programming and Scripting

cutting long text by special char around 100 byte and newline

Regard, How can i cut the text by special char(|) around 100 byte and write the other of the text at newline using Perl. ... (3 Replies)
Discussion started by: Shawn, Lee
3 Replies

4. Shell Programming and Scripting

remove unwanted text using perl

Hello..I have a text file that need to remove unwanted text. This is the original file. No. Time Source Destination Protocol Info 16 0.649949 10.1.1.101 209.225.11.237 HTTP POST /scripts/cms/xcms.asp HTTP/1.1 ... (9 Replies)
Discussion started by: taxi
9 Replies

5. Shell Programming and Scripting

Cutting out text from specific portion on filename

Hi, how do I go about cutting out the first numeric characters after the word "access"? access1005101228.merged-00.15.17.86.d8.b8.log.gz (16 Replies)
Discussion started by: GermanJulian
16 Replies

6. Shell Programming and Scripting

PHP header text/csv unwanted line feed character

We have successfully created a comma delimited file, the results are correct from an sql database query. When using the following headers to print the file using print $data, an extra line feed is added and a blank row appears on the top of the data in Excel: header("Expires: 0"); ... (0 Replies)
Discussion started by: ifimbres
0 Replies

7. Shell Programming and Scripting

grep out unwanted lines

Hi, I got a log file and I want to grep out a list of unwanted line which are IP's. Basiclly I want everything ecxept the ip's from my list. If I do a while read line do grep -v $ip_from_my_list logfile done <ip_list it just grep's one IP at a time and repeats. :( Thanks for... (3 Replies)
Discussion started by: stinkefisch
3 Replies

8. Shell Programming and Scripting

How to cut first line only from a text near a specific column without cutting a word

First I have to say thank you to this community and this forum. You helped me very much builing several useful scripts. Now, I can't get a solution the following problem, I'm stuck somehow. Maybe someone has an idea. In short, I dump a site via lynx and pipe the output in a file. I need to... (7 Replies)
Discussion started by: lowmaster
7 Replies

9. Shell Programming and Scripting

Eliminate unwanted data

Hi, I am stuck on writing a script that reads a file, retains wanted data but discards unwanted data from a CSV file. This is a sample of my table {not the actual data) ID Color tel_num Name color2 color3 abcdef green 5551212 jj88 red blue acbdfe yellow... (5 Replies)
Discussion started by: t524ube
5 Replies

10. Shell Programming and Scripting

Cutting text from one location to another

The following text appears multiple times in a script and it resides in many scripts. I would like to make the following changes to the text: Text: /usr/local/bin/gmail -t abc@yahoo.com -m "this is a test" -f xyz@yahoo.com I need to cut the text that comes after -m which is "this is a... (8 Replies)
Discussion started by: hemangjani
8 Replies
Login or Register to Ask a Question