Search Results

Search: Posts Made By: nms
7,249
Posted By stomp
Nearly correct. Try this: perl -pe 's{(\(...
Nearly correct. Try this:

perl -pe 's{(\( .*? \))}{$1 =~ y/ //dr}gex' file.txtor a little shorter and maybe more robust:

perl -pe 's/(\([^)]+\))/$1 =~ s, ,,r/e;' file.txtPerls feature use...
1,075
Posted By vgersh99
awk -F= 'FNR==NR{f1[FNR]=$0;next} {print $1 "_"...
awk -F= 'FNR==NR{f1[FNR]=$0;next} {print $1 "_" f1[FNR], $2}' file1 OFS="=" file2
1,075
Posted By nezabudka
awk '(getline tmp < "file1") { print $1 "_" tmp...
awk '(getline tmp < "file1") { print $1 "_" tmp FS $2}' FS="=" file2
3,766
Posted By RudiC
Strange. I vaguely remember we had a similar...
Strange. I vaguely remember we had a similar problem quite some time ago, but can't find the solution.
For debugging, in the script, echo the variables, and run the ps ax | ... pipe on its own to...
980
Posted By RudiC
Pass parameters into awk with the -v option: awk...
Pass parameters into awk with the -v option: awk -vMDIR="$MATTDIR" ' ... "/scripts/" MDIR "..."
And, yes, you can getline var < file (c.f. man awk)
And, how about saving one execution of your first...
1,986
Posted By vgersh99
If on Solaris, use either nawk or...
If on Solaris, use either nawk or /usr/xpg4/bin/awk
1,986
Posted By rdrtx1
PROCESS=beVWARS CRITICAL_SIZE=3600 ...
PROCESS=beVWARS
CRITICAL_SIZE=3600
CRONOUTFILE=cronoutfile

echo "Critical - the following processes $PROCESS are less then $CRITICAL_SIZE - $(awk '$1== proc && $3 < cs {printf (!c++ ? "" : ",")...
1,800
Posted By MadeInGermany
I like the shell solution in post#2, it is also a...
I like the shell solution in post#2, it is also a bit closer to the attempt in post#1.
Looping over the values is somewhat simpler than over the indexes
read -a intf < test.txt
for i in...
1,800
Posted By rdrtx1
sed 's/net/\nnet/g' test.txt | awk ' ...
sed 's/net/\nnet/g' test.txt | awk '
/^net.*:.*Tx *=.*Rx *=/ {
tx=$0;
sub(".*Tx= *", "", tx);
sub("[^0-9].*", "", tx);
rx=$0;
sub(".*Rx= *", "", rx);
sub("[^0-9].*", "", rx);...
1,800
Posted By Scrutinizer
Hello Matthew, you could do something like: ...
Hello Matthew, you could do something like:
read -a intf < test.txt
for ((i=0; i<${#intf[@]}; i++))
do
IFS=',:=' read ifname status x tx x rx <<< "${intf[i]}"
echo "This is interface...
8,045
Posted By RavinderSingh13
Hello nms, Could you please try following...
Hello nms,

Could you please try following and let me know if this helps you.

awk '/CRITICAL/{count++} END{print "CRITICAL ",count}' Input_file
on a Solaris/SunOS system, change awkto...
8,045
Posted By RavinderSingh13
Hello nms, I believe I had given this...
Hello nms,

I believe I had given this answer in my POST#2 of this thread https://www.unix.com/303003374-post2.html, kindly have a look to it and let me know if you have any queries on same. Also...
8,045
Posted By RudiC
How about (untested) grep -Eo...
How about (untested)
grep -Eo "String1|String2|String3" file.txt | sort | uniq -c
1,383
Posted By jim mcnamara
Change this: if [ $? -eq 0 ]; then ...
Change this:

if [ $? -eq 0 ]; then
wait $script1
wait $script2
wait $script3
rm -f ${LOCKFILE}
elif [ $? -eq 1 ]; then
rm -f ${LOCKFILE}
fi

To something...
1,718
Posted By jim mcnamara
The sqlplus command start is meant for that use: ...
The sqlplus command start is meant for that use:

#!/usr/bin/sh
filename="$1"
ocommand="sqlplus -s / as sysdba <<-EOF
start $filename
exit;
EOF
"
su - oracle -c "$ocommand"


Your sample...
1,579
Posted By Corona688
while true do echo "Destination one"...
while true
do
echo "Destination one" >&5
echo "Destination two" >&6
echo "Destination one again" >&5
break
done 5>destone 6>&1 | less

5 and 6 are...
1,579
Posted By MadeInGermany
If this one echo statement is the only output I...
If this one echo statement is the only output I would go indeed for
output=`echo $DATE "|" $int "|" $speed "|" $status "|" $inUsage "|" $perinUsage "|" $outUsage "|" $peroutUsage`
echo "$output"...
1,579
Posted By RudiC
Your TIME_INTERVAL variable is not expanded by...
Your TIME_INTERVAL variable is not expanded by the shell, so your results may not be the desired ones.
And, I'm not sure I understand why you overwrite the output file again and again in the loop,...
3,249
Posted By Don Cragun
If I understand what you are asking correctly,...
If I understand what you are asking correctly, you are saying that you have a variety of cron jobs scheduled separately using crontab. And, instead of having multiple scripts with separate entries...
3,249
Posted By rovf
Like Don Cragun said, I really don't see a point...
Like Don Cragun said, I really don't see a point in your goal, and why you try to reinvent cron, but if you really want to do:

You are thinking of an infinite loop. Well, in your example code, you...
7,471
Posted By jim mcnamara
You probably need to specify a complete file: ...
You probably need to specify a complete file:
-o /path/to/textfile.txt

cron runs as root, then su to the owner of the crontab file. It DOES NOT execute any of the login scripts. So there is a...
1,731
Posted By rbatte1
I'm not sure if you expoect lots of messages to...
I'm not sure if you expoect lots of messages to rush through at any time, but that could be painful calling grep for each and every one one.
If the string you are checking is exactly what you show...
1,731
Posted By rbatte1
Which OS and version are you using? The output...
Which OS and version are you using? The output from uname -a would be very helpful.

You might find that tail has a -F flag in your version. have a look in the man page and see if it is...
1,731
Posted By joeyg
If I understand what is happening, the process...
If I understand what is happening, the process that builds the server.log file closes the file at 23:59. It then renames the file and open a new server.log file.

I know you tried to wait a few...
1,731
Posted By RudiC
Elaborating on what rbatte1 already alluded to...
Elaborating on what rbatte1 already alluded to above: the man page for tail (GNU coreutils) 8.25 reads:


Which I guess would exactly solve your problem.
Showing results 1 to 25 of 36

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