Search Results

Search: Posts Made By: krbala1985
2,589
Posted By yinyuemi
awk 'NR==FNR{a[$1]=$2;next} {for(i=1;i<=NF;i++)...
awk 'NR==FNR{a[$1]=$2;next}
{for(i=1;i<=NF;i++) if($i in a) print a[$i] FS $0}' pattern report
4 i like very much
2 but john is good boy
3 i will love u
2,993
Posted By sk1418
awk 'FNR==NR && FNR>1{a[$1]=$2} NR>FNR{...
awk 'FNR==NR && FNR>1{a[$1]=$2} NR>FNR{ for(i=1;i<=NF;i++) if($i in a) $i=a[$i]$i; print $0}' pattern.txt chennai.dat
3,967
Posted By Chubler_XL
last=$(ls *.CLT| cut -c7-10| sort -n |tail -1) ...
last=$(ls *.CLT| cut -c7-10| sort -n |tail -1)
new=$(printf "%04d" $((10#${last}+1))) #determine the next consecutive number.
cat *.CLT > $(date +%y%m%d)$new.CLT

or without using cut...
3,967
Posted By rdcwayx
newfile=`ls *.CLT |awk -v today=$(date +%y%m%d)...
newfile=`ls *.CLT |awk -v today=$(date +%y%m%d) '{max=(substr($0,7,10)>max)?substr($0,7,10):max}END{printf "%6s%04d.CLT",today,max+1}'`
cat *.CLT > $newfile
3,967
Posted By rdcwayx
Ok, if the understand is right. Last=$(ls...
Ok, if the understand is right.

Last=$(ls *.CLT|sort -n |tail -1)
let new=${Last%.*}+1 #determine the next consecutive number.
cat *.CLT > $new.CLT
2,782
Posted By Chubler_XL
ls wrk/*.R | awk ' { sub("^wrk/", ""); ...
ls wrk/*.R | awk '
{
sub("^wrk/", "");
sub(".R$", "");
pre=post=$0;
sub("[0-9]*$", "", pre);
sub("^[A-Z]*", "", post);
new=sprintf("%04d", ++P[pre]);
if (new !=...
3,967
Posted By Chubler_XL
How about this, should work in bash or ksh ...
How about this, should work in bash or ksh

MAX=0
for file in wrk/[0-9]*.CLT
do
CNT=${file##wrk/}
CNT=${CNT%%.CLT}
[ $CNT -gt $MAX ] && MAX=$CNT
LIST="$LIST $file"
done...
2,934
Posted By yinyuemi
Please try: awk -v RS="%s" 'NR==FNR &&...
Please try:

awk -v RS="%s" 'NR==FNR && NR!=1{a[$1]=a[$1]"%s"$0}END{for(i in a) print "%s"a[i] >"MUMBAI000"++x".txt"}' urfile
2,934
Posted By DGPickett
Well, consider the merge to be another task,...
Well, consider the merge to be another task, rather than cluttering the process that works. The only thing you might need is keys, which might go into the file name. Then, you can process the file...
28,908
Posted By rubin
If the blank line between CREATE TABLE paragraphs...
If the blank line between CREATE TABLE paragraphs is always present this should suffice:

awk '/CREATE TABLE/{ n++; print > (f="out_" n); close(f)}' RS= sql_file

Otherwise use,

awk...
Showing results 1 to 10 of 10

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