Search Results

Search: Posts Made By: kokoro
2,113
Posted By vgersh99
the usual paradigm... awk...
the usual paradigm...

awk 'FNR==NR{m[$4];next} $4 in m' mappingFile sourceFile
1,737
Posted By balajesuri
static_date=20120529 old_date=$((static_date -...
static_date=20120529
old_date=$((static_date - (3 * 10000)))
future_date=$((static_date + (2 * 10000)))
1,737
Posted By bartus11
old_date=`echo $static_date | awk '{print...
old_date=`echo $static_date | awk '{print substr($0,1,4)-3""substr($0,5)}'`
future_date=`echo $static_date | awk '{print substr($0,1,4)+2""substr($0,5)}'`
5,683
Posted By pandeesh
awk '{ORS=NR%3?",":"\n"}'...
awk '{ORS=NR%3?",":"\n"}' filename
5,683
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,,
5,683
Posted By neutronscott
$ awk '{printf("%s%s",$0,NR%3?",":"\n")}' input ...
$ awk '{printf("%s%s",$0,NR%3?",":"\n")}' input
a,b,c
d,e,f
g,h,i
j,
7,148
Posted By Corona688
I think this is closer to what you want, and far...
I think this is closer to what you want, and far more efficient than running grep 9,000 times to process 9,000 different matches. It loads the entire mapping file in at once into an associative...
7,148
Posted By balajesuri
#! /bin/bash while read x do ...
#! /bin/bash
while read x
do
mapped=`grep $x output`
echo ${mapped#*|}
done < input_string.txt
4,699
Posted By jim mcnamara
download and install the shell compiler shc: ...
download and install the shell compiler shc:

Download shc 3.8.6 for Linux - shc project is a generic shell script compiler. - Softpedia...
2,650
Posted By tarun_agrawal
I hope this will anwer your query awk ...
I hope this will anwer your query


awk 'NR==FNR{a[$1]=$1;next} {for(v in a){ print v","$0 | "sort -n -k1" }}' file1 file2
1,766
Posted By Corona688
I think your regex isn't working. You can make...
I think your regex isn't working. You can make it a lot simpler.

$ diff file1.txt file2.txt | awk '/^</ { printf("%-20s\n", $2) }'
2,469
Posted By Corona688
"print" is a KSH-only thing. It's not on BASH...
"print" is a KSH-only thing. It's not on BASH because BASH is not KSH. Use 'echo', which truly is everywhere, in binary and builtin forms.

Or printf, with its more advanced features.

Or if...
4,572
Posted By Corona688
By overwriting it with the temp file. awk,...
By overwriting it with the temp file.

awk, and nearly any stream-based utility, does not edit "in place". If you try to write to the same file at the same time you'll destroy it.
4,572
Posted By bartus11
Try: awk -vd=`date +%Y%m%d` -F"|" -vOFS="|"...
Try: awk -vd=`date +%Y%m%d` -F"|" -vOFS="|" '{$6=d}1' file
6,132
Posted By balajesuri
[ $date -gt `date -d "+6 days" +%Y%m%d` ] I...
[ $date -gt `date -d "+6 days" +%Y%m%d` ]

I assume you can "substr" date from each line successfully yourself.
1,573
Posted By zaxxon
Please use code tags next time, thanks. ...
Please use code tags next time, thanks.


pos=$(expr index $name [oO])
11,835
Posted By balajesuri
printf "%-20s%-40s%-20s\n" "$a" "$b"...
printf "%-20s%-40s%-20s\n" "$a" "$b" "$c"
Showing results 1 to 17 of 17

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