11-13-2009
Issue Filtering Tail
Hi Folks,
I have a log that contains data as shown below:
11:59:43,144 [strategy.SNTH] (1,850) Signal : ....
11:59:44,109 [strategy.SNTH] (1850) Bps : .....
I wish to remove "[strategy.SNTH]" from all lines and it is on the start of every line. I have achieved that successfully using the command:
tail -f imp.log | sed 's/\ \[\<strategy.SNTH\>\]//g'
OR
tail -f imp.log | perl -pe "s/\ \[strategy\.SNTH\]//g"
I also wish to remove all lines containing the word "Bps". I achieved that using the following command:
tail -f imp.log |grep -v 'Bps'
The issue is, I cannot figure out how to string the two commands together.
Help please!
Regards,
Umair
---------- Post updated at 12:15 PM ---------- Previous update was at 12:14 PM ----------
And something to remove the milliseconds at the start of each line would be much appreciated too.
11:59:44,109 to just 11:59:44
Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Working in HP-UX 10.20. I eventually want to write a bourne shell script to handle the following problem, but for now I am just toying with it at the command line.
Here's what I am basically trying to do:
tail -f log_X | grep n > log_Y
I am doing a tail -f on log_X . Once it sees "n", I... (6 Replies)
Discussion started by: cdunavent
6 Replies
2. Shell Programming and Scripting
I am trying to extract a particular line from a.log which keeps appending every sec and output that into a newfile b.log which should append itself with filtered data received from a.log
I tried
tail -f a.log |grep fail| tee -a b.log
nothing in b.log
tail -f a.log |grep fail >>b.log
... (4 Replies)
Discussion started by: wannalearn
4 Replies
3. Shell Programming and Scripting
The problem I have is that I have 23,000 records I need to sort through to pull out LEN: XXXX XX XX XX XX and NCOS: XXX entries from so I can insert them into a database. But some of my records include TYPE: ISDN, THE DN IS UNASSIGNED, or INVALID entries in between some records and I would like... (2 Replies)
Discussion started by: roachmmflhyr
2 Replies
4. Shell Programming and Scripting
Hi,
Could any one help me to extract data from a report.
I would like to get the two lines which are just below the separations
I have a report like this
--------------------------------------------------------------------------
Pid Command Inuse Pin Pgsp Virtual... (2 Replies)
Discussion started by: ajilesh
2 Replies
5. Shell Programming and Scripting
Hi,
I had few scripts which were running fine on linux:
uname -a
Linux ######### 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:33:05 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
from some front end application. Recently there was a migration of this application on some other linux m/c:
uname -a... (4 Replies)
Discussion started by: dips_ag
4 Replies
6. Shell Programming and Scripting
Hello,
I am using a tail command to fetch the line before last in a log file.
the two last lines are as followed:
11-01-16 11:55:45.174 | CClientObject::InitTraceLevelInCache Starting
CClientObject::InitTraceLevelInCache End
I am doing a awk statement to gather only the numeric... (1 Reply)
Discussion started by: LiorAmitai
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am on
uname -a
HP-UX mymachine B.11.31 U ia64 3223107173 unlimited-user license
ps -exx| grep java | grep -i "GrafiteEventsInterfaces*"
19955 ? 55:22 /opt/app/app1/jdk150_07/bin/IA64N/java -server -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m... (2 Replies)
Discussion started by: mohtashims
2 Replies
8. Shell Programming and Scripting
I have 250 files that have 16 columns each - all numbered as follows stat.1000, stat.1001, stat.1002, stat.1003....stat.1250.
I would like to join all 250 of them together tail by tail as follows. For example
stat.1000
a b c
d e f
stat.1001
g h i
j k l
So that my output... (2 Replies)
Discussion started by: kayak
2 Replies
9. UNIX for Dummies Questions & Answers
Hello,
When I am trying to use tail +13 filename.csv it is throwing an error.
tail: cannot open `+13' for reading: No such file or directory and then prints last 10 lines of the file. (File is present on the path)
But when i try tail -13 filename.csv it runs perfectly.
Could I have... (5 Replies)
Discussion started by: AnkitSenghani
5 Replies
10. Shell Programming and Scripting
because the tail +2 on the first line gives me the file name pomga I do not want anything like what I miss
tail +2 ejemplo.txt
ouput
==> ejemplo.txt <==
1
2
3
4
5
6
7
8
9
10 (2 Replies)
Discussion started by: tricampeon81
2 Replies