Search Results

Search: Posts Made By: H squared
6,680
Posted By RudiC
How about awk -F, -v"FLDS=5,8" ' BEGIN ...
How about
awk -F, -v"FLDS=5,8" '
BEGIN {FCNT = split(FLDS, FLD)
}

function CV(TMP) {Y = int(TMP/1E4)
return sprintf...
6,680
Posted By vgersh99
I'll leave it up to you to implement the shell...
I'll leave it up to you to implement the shell wrapper script, but...
for the 3 fields (5,8 and 12) to be modified, awk should be called as:
awk -v fld='5,8,12' -f hsquared.awk myFile.csv
6,680
Posted By vgersh99
a bit verbose and can be simplified - just...
a bit verbose and can be simplified - just following your description.

awk -v fld='5,8' -f hsquared.awk myFile.csv
where hsquared.awk is:
BEGIN {
FS=OFS=","
fld=(!fld)?"5":fld
...
22,663
Posted By RavinderSingh13
Hello H squared, Please use code tags as per...
Hello H squared,

Please use code tags as per forum rules for commands/Inputs/codes you are using into your posts. If you have an Input_file and you want to print all the lines into reverse order...
10,117
Posted By RavinderSingh13
Hello H squared, Following may help you in...
Hello H squared,

Following may help you in same.(tested with GNU awk).

awk '($0 ~ /[[:digit:]]/){print;next} ($0 ~ /[[:alpha:]]/){num=split($0, A,"");for(i=1;i<=num;i+=2){Q=Q?Q A[i]:A[i]};Q=Q...
10,117
Posted By Don Cragun
Hi H squared, That isn't the way arrays work. ...
Hi H squared,
That isn't the way arrays work. Reading an array creates elements based on field splitting; not arrays of individual characters. But, both recent versions of bash and 1993 or later...
10,117
Posted By Akshay Hegde
Try [akshay@localhost tmp]$ cat f 2 ...
Try

[akshay@localhost tmp]$ cat f
2
Haider
Bash
[akshay@localhost tmp]$ awk '!/^[0-9]/{split($0,a,""); e=o="";for(i=1; i in a; i++) i%2?e=e a[i]:o=o a[i]; print e,o }' f
Hie adr
Bs ah
1,772
Posted By Don Cragun
Hi Haider, That takes care of the syntax error...
Hi Haider,
That takes care of the syntax error in your code. But you need to look at post #3 where cero points out the logic error in your code...
1,772
Posted By cero
Hi, you see the syntax error because there is a...
Hi,
you see the syntax error because there is a space missing: [$c = $a ] should be [ $c = $a ]. The else branch is never hit because $a either matches $b or it doesn't. Maybe you mixed up the OR...
1,772
Posted By Don Cragun
You need to show us the actual script that you...
You need to show us the actual script that you are running; not just something similar to it. The diagnostic you have shown us says there is a problem on line 5 in main.sh, which in the script you...
1,818
Posted By RavinderSingh13
Hello H squared, Could you please try...
Hello H squared,

Could you please try following and let me know if this helps you.

awk 'FNR==NR{A[$1]=$1;next} ($1 in A){print $1 >> "similar_ones.txt";delete A[$1];next} !($1 in A){print $1 >>...
2,634
Posted By RudiC
Don't pipe through tee but redirect using > .
Don't pipe through tee but redirect using > .
1,132
Posted By RudiC
Unfortunately you don't mention your OS/shell...
Unfortunately you don't mention your OS/shell etc. Here's one possible solutionfind . -exec stat -c "%y %F %n" {} + | sort -r | head -1
1,132
Posted By himanshu sood
Hello , ls -ltr | grep ^d | head -1 -->...
Hello ,

ls -ltr | grep ^d | head -1 --> Directories
ls -ltr | grep ^-r | head -1 --> Files

Thanks,
Himanshu Sood
1,446
Posted By RavinderSingh13
Hello Haider, Not tested though, could you...
Hello Haider,

Not tested though, could you please try following and let us know how it goes. Also make sure while setting this script to crontab you run it to 00:00 AM of your box time.
...
1,446
Posted By MadeInGermany
If your script runs every hour, and the serialno...
If your script runs every hour, and the serialno resets at 00:00, then you can simply take the current hour as serialno.
The following is suitable for hourly crontab

ext=$(date +"%F").AAAAA$(date...
2,190
Posted By Don Cragun
You ask us to note spaces and tabs, but you...
You ask us to note spaces and tabs, but you didn't use CODE tags (which are required for us to be able to distinguish tabs and multiple spaces from single spaces). You got an email message and an...
Showing results 1 to 17 of 17

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