Search Results

Search: Posts Made By: ux4me
1,188
Posted By RudiC
Be careful - if there's no minus in a line, it...
Be careful - if there's no minus in a line, it wont print!
Tryawk '{sub(/-[0-9]*$/,",&", $NF); sub (/,-/,",", $NF)}1' file
17,356
Posted By CarloM
echo "$var1" (otherwise you're passing echo a...
echo "$var1"
(otherwise you're passing echo a list of arguments, which it outputs separated by space)
6,755
Posted By ygemici
I write a simple one for check connection. you...
I write a simple one for check connection. you can add/remove for your system and enviroment..good lucks :)

#!/usr/bin/expect --
set IP [lindex $argv 0]
set PORT [lindex $argv 1]
set timeout 2...
14,414
Posted By radoulov
Consider the following: zsh-5.0.0[t]% cat...
Consider the following:
zsh-5.0.0[t]% cat infile
a1
a2
a3
a4
a5
a6
a7
b1
b2
b3
b4
b5
b6
b7
z1
z2
z3
z4
14,414
Posted By radoulov
Hm ..., it should be something like this: ...
Hm ..., it should be something like this:

awk '{
r = length(r) ? r OFS $0 : $0
}
!(NR % 7) {
print r
r = x
}' infile
14,414
Posted By radoulov
awk 'ORS=NR%7?FS:RS' infile
awk 'ORS=NR%7?FS:RS' infile
2,224
Posted By MadeInGermany
To print the null outputs, you need the other...
To print the null outputs, you need the other approach, but add a 0 to force a number.
awk '/=\+/ { okcount++ } /=\-/ { errcount++ } /=\0/ { waitcount++ } /=\?/ { runcount++ }
END { print "Status:...
2,224
Posted By vidyadhar85
you are missing one closing curly bracket at the...
you are missing one closing curly bracket at the end.
2,224
Posted By MadeInGermany
A hash can save you specifying each item twice...
A hash can save you specifying each item twice (once for the variable and once for the printout).
awk '
/=\+/ { C["OK"]++ }
/=\?/ { C["RUNNING"]++ }
/=\-/ { C["ERROR"]++ }
/=\0/ { C["WAITUNG"]++...
2,224
Posted By anbu23
awk '/\=\+/ { countplus++ } /\=\?/ { countqn++ }...
awk '/\=\+/ { countplus++ } /\=\?/ { countqn++ } END { print "Status: " countplus " OK , " countqn " Running" }' filename
1,658
Posted By ctsgnb
Assuming your input exactly looks like the...
Assuming your input exactly looks like the example you provided :

echo $test | awk -F"= =" 'NF%2{print "Deploymeny still in progress"}'
1,962
Posted By guruprasadpr
One way: awk '!/^[0-9]/{x=$0;if(NR!=1)print...
One way:

awk '!/^[0-9]/{x=$0;if(NR!=1)print "";next}{print x,$0}' file
3,226
Posted By bmk
Try like.. echo "12345" |sed...
Try like..
echo "12345" |sed 's/./&./g;s/.$//'
3,226
Posted By elixir_sinari
Like this? echo "12345" | sed...
Like this?
echo "12345" | sed 's/./&./g;s/\.$//'
1.2.3.4.5
1,760
Posted By elixir_sinari
awk -vRS= -vfsize="$fsize" '{printf("%.1f MB/s...
awk -vRS= -vfsize="$fsize" '{printf("%.1f MB/s %.1f%%\n",fsize/$2,100*($4+$6)/$2)}' timex2.out
1,760
Posted By neutronscott
$ awk -vRS= '{printf("%.1f MB/s...
$ awk -vRS= '{printf("%.1f MB/s %.1f%%\n",6144/$2,100*($4+$6)/$2)}' timex2.out
8.8 MB/s 67.3%
4,349
Posted By itkamaraj
try this awk -F,...
try this
awk -F, '/mbeanName/{printf("%s",$3)}/Get attribute Properties/{printf(" %s\n",$2)}' file
4,349
Posted By guruprasadpr
Hi $ awk -F, '/mbeanName/{printf $3}/Get...
Hi


$ awk -F, '/mbeanName/{printf $3}/Get attribute Properties/{print $2}' file
SAP_J2EEClusterNode=3620850 deployment_forbidden=off
SAP_J2EEClusterNode=3620851 deployment_forbidden=off

...
4,349
Posted By itkamaraj
END block will execute only once. So, your...
END block will execute only once.

So, your substring1, substring2 will be overwritten and only the last value will remain in those variable.


awk 'BEGIN {
FS = ","
...
2,216
Posted By elixir_sinari
With a single awk: awk -F_ '{ host[$4]=$1 ...
With a single awk:

awk -F_ '{
host[$4]=$1
inst[$4]=$2
dirs[$4]=dirs[$4]?dirs[$4]","$3:$3} END{
for(i in host) printf("Time: %s\tHost: %s\tInstance: %s\tDirs: %s\n",i,host[i],inst[i],dirs[i])}'...
2,216
Posted By Ygor
All in one...awk 'BEGIN { FS = "_" ...
All in one...awk 'BEGIN {
FS = "_"
fmt = "%sTime: %s Host: %s Instance: %s Dirs: "
}
{
if ($4 != prev) {
printf fmt, (dirs?dirs ORS:""), $4, $1,...
2,216
Posted By raj_saini20
awk -F"_" 'BEGIN{x=0}{if($4==x){print...
awk -F"_" 'BEGIN{x=0}{if($4==x){print "\t"$1"_"$2"_"$3}else{print $4;print "\t"$1"_"$2"_"$3};x=$4}' inputfile
2,216
Posted By Klashxx
If you have a huge file i would use this: sort...
If you have a huge file i would use this:
sort -t_ -T /path/for/temporary/scratch/files -n -k 4.4 bigfile|awk -F\_ 'a!=$NF{print $NF;a=$NF}{print "\t"$1""FS""$2""FS""$3}'
2,216
Posted By elixir_sinari
awk -F_ '{ ...
awk -F_ '{
a[$NF]=a[$NF]?a[$NF]"\n\t"substr($0,1,(index($0,$NF)-2)):$NF"\n\t"substr($0,1,(index($0,$NF)-2))
}END{for(i in a) printf("%s\n\n",a[i])}' inputfile

EDIT: Hope it's not a huge file...:)
2,806
Posted By vgersh99
I don't quite follow.... What's your original...
I don't quite follow....
What's your original input?
It seems that your input format has changed....
We don't need to to create the intermediate output to be reprocessed - we can produce whatever...
Showing results 1 to 25 of 34

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