Search Results

Search: Posts Made By: ryandegreat25
2,138
Posted By Scott
The timestamp is the first field. while...
The timestamp is the first field.

while IFS=" " read timestamp severity x msg1 server y z msg2 junk; do
...
done



$ cat -n args.txt
1 2013/08/07 04:48:36:685
2 NORMAL
...
2,138
Posted By Scott
Why would you want to use awk? There's a...
Why would you want to use awk?

There's a number of ways. Such as:


awk '{print "converter.pl -r MS_OVO_PROXY -c \"" $2 "\" -t T -i ORA_PERF_ALERT -h \"" $5 "\" -e ORA -m \""$4,$8 "\""}' file...
1,287
Posted By rbatte1
You could read the log in real time with tail -f...
You could read the log in real time with tail -f if that helps. Beyond this, you may need to keep and old version and compare them. Using diff can be awkward because it adds editing messages if you...
2,138
Posted By rbatte1
May I suggest that the awk is massive overkill. ...
May I suggest that the awk is massive overkill. If you are happy with a while read line loop, then try:-while read timestamp severity x1 msg1 server x2 x3 msg2 rest
do
message="$msg1 $msg2"
...
2,138
Posted By Scott
while read TIME SEV x MESS1 SERV x x MESS2 junk;...
while read TIME SEV x MESS1 SERV x x MESS2 junk; do
converter.pl -r MS_OVO_PROXY -c "$SEV" -t T -i ORA_PERF_ALERT -h "$SERV" -e ORA -m "$MESS1 $MESS2"
done < file
1,705
Posted By MadeInGermany
sep=`printf "\t"` while IFS="$sep" read date...
sep=`printf "\t"`
while IFS="$sep" read date severity field3 field4 lastfields
do
echo "date=$date severity=$severity"
done < file
1,705
Posted By RudiC
Why notawk '{print "server:" $4 "\tdate:" $1...
Why notawk '{print "server:" $4 "\tdate:" $1 "\tseverity:"$2}' FS="\t" test.log
1,705
Posted By Jotne
Is the goal to convert the log to another...
Is the goal to convert the log to another format?
Or do you do anything with the data?

You could use this and print the filed you like.
awk '{split($0,s,"\t");print...
1,705
Posted By Jotne
You can use the split function in awk, then...
You can use the split function in awk, then select columns to work with like s[1] s[8]
awk '{split($0,s,"\t");print s[1]}' test.log
2013/08/05 06:50:38:067
2013/08/05 06:50:38:067
2013/08/05...
2,423
Posted By alister
Assuming nothing more than that the data is a...
Assuming nothing more than that the data is a valid text file, while the following traps may not trigger often, I think it's a good idea to mention them for the benefit of novices considering adding...
2,423
Posted By Corona688
Supposing the columns are separated by , there's...
Supposing the columns are separated by , there's a few things you can do.

I like the set -- feature a lot, it's a simple thing which exists in any Bourne shell, capable of replacing arrays for...
9,860
Posted By vishnudev1
I was able to modify the solution in another...
I was able to modify the solution in another forum to match my requirement.
I tested and this is perfect for me. I appreciate all your help.


#!/bin/ksh

WAITTIME=5

# run the idql...
2,423
Posted By Corona688
Awk doesn't mysteriously stop working inside...
Awk doesn't mysteriously stop working inside while loops, no.

I can only guess what your friend meant, but I'm assuming the lesson intended was "Don't run awk 30,000 times to process 10,000...
3,336
Posted By itkamaraj
https://www.unix.com/shell-programming-scripting/11...
https://www.unix.com/shell-programming-scripting/118425-how-ti-check-if-passwordless-ssh-enabled-between-two-systems.html
1,109
Posted By sk1418
if all your filenames are in this pattern as your...
if all your filenames are in this pattern as your example, take a look the test and output below:
echo "T201108221033_P001736.Sep_5_1457.csv" |awk -F'[P.]' '{print $2}'
001736



if you don't...
Showing results 1 to 15 of 15

 

Featured Tech Videos

All times are GMT -4. The time now is 11:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy