Search Results

Search: Posts Made By: vaibhavkorde
11,572
Posted By sk1418
have you tried my command? i used NR, at the...
have you tried my command?
i used NR, at the end, the NR indicates: how many lines in your file.

if you apply the command on a different file, it works as well, for example:

echo "1 32 ...
1,317
Posted By Tytalus
using (n)awk: # nawk...
using (n)awk:


# nawk 'NR==FNR{x[$1]=$2;next}{print x[$1]}' map infile
2
45
2
56
98
6598
98
56
56
98
98


HTH
1,703
Posted By Franklin52
With one awk command: awk...
With one awk command:
awk 'NR==FNR{sum+=$3;next}{print $3 "/" sum " = " $3/sum}' OFS="\t" FILE1 FILE1
2,882
Posted By pravin27
Try this, awk 'NR==FNR{a[$0]++;next}...
Try this,
awk 'NR==FNR{a[$0]++;next} a[$0]{b[$0]=b[$0]+1} END {for(j in b) {print "count of ",j,":",b[j]}}' temp_uniq.txt temp.txt
1,657
Posted By alister
The following approach works by manipulating the...
The following approach works by manipulating the comma-delimited string into valid brace expansion syntax.

#!/bin/ksh

while read seq; do
while [ "${seq//[!,]}" ]; do
echo...
1,657
Posted By ctsgnb
awk -F, '{for(i=1;i<NF;i++){for(j=i+1;j<=NF;j++)...
awk -F, '{for(i=1;i<NF;i++){for(j=i+1;j<=NF;j++) x=(x?x" ":y)$i","$j;print x;x=y}}' infileUse nawk instead of awk if on SunOS or Solaris :

# cat tst
12,23,45,1,2,3,5,54,8,4,1,65,6,6
1,2,3,4,5...
1,657
Posted By pravin27
How about this, awk -F, '{for(i=1;i<=NF;i++)...
How about this,
awk -F, '{for(i=1;i<=NF;i++) {for(k=i+1;k<=NF;k++){printf " " $i FS $k}printf "\n"}}' inputfile
12,185
Posted By fpmurphy
You can also calculate the decimal equivalent of...
You can also calculate the decimal equivalent of an IP4 address using shell bit arithmetic. For example

#!/bin/ksh93

[[ $# != 1 ]] && {
echo "Usage: $0 ipaddress"
exit 1
}
...
12,185
Posted By Ygor
Try...$ echo "172.16.112.100"|awk -F '\\.'...
Try...$ echo "172.16.112.100"|awk -F '\\.' '{printf "%d\n", ($1 * 2^24) + ($2 * 2^16) + ($3 * 2^8) + $4}'
2886758500
1,058
Posted By homeboy
try this,"file" is the input file sed...
try this,"file" is the input file
sed 's/\(.\)/\1 /g' file | awk '{a=$1||$3;b=$2||$4;printf "%d%d(binary)=%d(decimal)\n",a,b,a*2+b}'
1,358
Posted By cfajohnson
awk -F: '{printf "%10d\n", $1 * 3600000 + $2 *...
awk -F: '{printf "%10d\n", $1 * 3600000 + $2 * 60000 + $3*1000}' "$file"
1,358
Posted By fpmurphy
Since you appear to be dealing with only seconds...
Since you appear to be dealing with only seconds and milliseconds:

awk -F: '{print $3*1000}' infile
1,592
Posted By Franklin52
Another approach: while IFS= read string do ...
Another approach:
while IFS= read string
do
echo ${string##*:}
done < file
1,592
Posted By bartus11
cut -d: -f2 file
cut -d: -f2 file
1,249
Posted By k_manimuthu
perl -ne 'print if(s/:+/$&/g <= 6)' input_file >...
perl -ne 'print if(s/:+/$&/g <= 6)' input_file > Output_file
1,249
Posted By panyam
awk -F":" 'NF-1<7' input_file
awk -F":" 'NF-1<7' input_file
1,249
Posted By zaxxon
Not pretty but works: $> cat infile 111 ...
Not pretty but works:

$> cat infile
111
222
3:3:3::3:
4
5: 5: delete me!: 5:5:5:555
this one up::
:66:6:666:6:6
7:::7 delete me too!::7::7:: : 7:
get me up!
$> sed...
1,249
Posted By k_manimuthu
perl -ne 'print if(s/:/:/g <= 6)' input_file >...
perl -ne 'print if(s/:/:/g <= 6)' input_file > Output_file
Showing results 1 to 18 of 18

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