Search Results

Search: Posts Made By: 47shailesh
15,716
Posted By itkamaraj
$ echo "Jan" | awk 'BEGIN{months=" ...
$ echo "Jan" | awk 'BEGIN{months=" JanFebMarAprMayJunJulAugSepOctNovDec"}{print index(months,$0)/3}'
1
$ echo "Feb" | awk 'BEGIN{months=" JanFebMarAprMayJunJulAugSepOctNovDec"}{print...
5,633
Posted By Scrutinizer
$ paste -d, - - - < infile a,b,c d,e,f ...
$ paste -d, - - - < infile
a,b,c
d,e,f
g,h,i
j,,
4,249
Posted By neutronscott
Standard awk unique program $ awk...
Standard awk unique program

$ awk '!a[$1,$2]++' input
D A 92.85 1315 83 11
D B 91.82 1321 92 16
D C 89.86 1321 119 15
You also want limited to just 3 matches: awk...
2,703
Posted By Scrutinizer
awk '$3||$4||$5||$6||$7' infile
awk '$3||$4||$5||$6||$7' infile
2,135
Posted By Franklin52
No, awk doesn't have something like an "eval"...
No, awk doesn't have something like an "eval" command.
896
Posted By Scrutinizer
Try: awk NF-=1 FS=- OFS=- infile | sort -u ...
Try:
awk NF-=1 FS=- OFS=- infile | sort -u
sed 's/-[^-]*$//' infile | sort -u
18,356
Posted By methyl
The > 80 will create a file called 80 (check your...
The > 80 will create a file called 80 (check your directory).

Have you tried:
#!/bin/sh

# Restart WHD if memory usage hits 80% or higher
#

if [ `ps aux | grep java | grep -v "grep" |...
4,118
Posted By Scrutinizer
If combined with filename expansion, no. If...
If combined with filename expansion, no.
If combined with a file list that has been word split using standard IFS after command substitution, then yes..
27,232
Posted By balajesuri
Few points to observe: 1. awk already separates...
Few points to observe:
1. awk already separates the fields based on whitespaces. So, -F " " is really not necessary.
2. awk follows this: condition {action} by default. So an if-statement can be...
16,018
Posted By agama
No need for the overhead of the pr command: ...
No need for the overhead of the pr command:


# case 1
awk -v f2=file2 ' { c = $2; getline < f2; print c, $5; } ' file1 >output-file

#case 2
awk -v f2=file2 ' { c = $2; getline < f2; print...
1,263
Posted By Corona688
Some versions of echo interpet \050 by default,...
Some versions of echo interpet \050 by default, some don't.

Some versions of echo support -e, some don't.

Some shell builtin versions of echo have their own behavior, different from the...
2,722
Posted By Corona688
$ cat addfr.awk BEGIN { A["FRR1"]=0.11;...
$ cat addfr.awk
BEGIN { A["FRR1"]=0.11; A["FRR4"]=0.13 }

A[$1] {
V=substr($0, 24, 5);
V += A[$1]
$0=substr($0, 0, 23) sprintf("%5s", V) substr($0, 29);
}

1

$ awk...
2,562
Posted By alister
Is always a bad idea. It's inefficient, since it...
Is always a bad idea. It's inefficient, since it involves forking another shell and exec'ing ls. Worse, if any of the ls output contains file or directory names which contain IFS characters...
Showing results 1 to 13 of 13

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