Search Results

Search: Posts Made By: RudiC
22,133
Posted By RudiC
Try awk ' ...
Try
awk '
{printf "%s\t", $0
}
...
12,863
Posted By RudiC
Redirection works identical for input as well as...
Redirection works identical for input as well as for output. Try
$ mv /tmp/new_file /tmp/old_file
$ while read product id features
do printf "${product}, %s\n" ${features%#*}
done <...
10,795
Posted By RudiC
Would this...
Would this (https://www.unix.com/303046306-post5.html) point you in the right direction to adapt your script?
14,268
Posted By RudiC
Adapting your own attempt, try awk 'NR==FNR...
Adapting your own attempt, try
awk 'NR==FNR {a[$2 $4] = $6; next} a[$2 $4] != $6' FS="," file1 file2
Forum: BSD 05-01-2020
34,470
Posted By RudiC
Depending on how you copied the .iso to the pen...
Depending on how you copied the .iso to the pen drive, the msdos formatting is gone, and iso9660 would be the FS type of choice. It has many mount options that might help in getting your task done.
Forum: BSD 05-01-2020
34,470
Posted By RudiC
What about cd0 / cd1? Looks like it thinks your...
What about cd0 / cd1? Looks like it thinks your iso is on a CD?
19,392
Posted By RudiC
It doesn't. It would remove any line with an...
It doesn't. It would remove any line with an emtpy $1, of which there is none. You can leave it out entirely. The $4 < 7000 removes the header line. $4 > 7000 would not; we'd need a different...
12,863
Posted By RudiC
Better than what? Any attempts / ideas / thoughts...
Better than what? Any attempts / ideas / thoughts from your side?


This...
19,392
Posted By RudiC
Try this: awk '$1 == "Name"; $4 < 7000 {print |...
Try this:
awk '$1 == "Name"; $4 < 7000 {print | "sort -k4"}' file
Name tDesignation tDepartment tSalary
Thomas Manager Sales 5000
Jason Developer Technology 5500
Vicky...
21,120
Posted By RudiC
Or, awk: awk -F"[,;]+" 'NR == 1 {print; next}...
Or, awk:
awk -F"[,;]+" 'NR == 1 {print; next} {for (i=2; i<=NF; i++) print $1, " " $i}' OFS=, file
Name , Company_Worked (Header)
Asley, IBM
Asley, Amazon
Asley, BOA
Asley, Google
King.Jr,...
19,392
Posted By RudiC
Try this for leading header and sorted data: ...
Try this for leading header and sorted data:
awk 'NR == 1; $4 < 7000 {print | "sort -k4"}' file
Name tDesignation tDepartment tSalary
Thomas Manager Sales 5000
Jason Developer Technology 5500...
13,966
Posted By RudiC
That's because if your first printout trigger /-/...
That's because if your first printout trigger /-/ is hit, only that array element is set yet. On top, all further date/time stamps do not match the data printed with them; the data are shifted one...
10,240
Posted By RudiC
I can't quite follow this request, nor do I...
I can't quite follow this request, nor do I understand its relation to the title "Ssh newbie", but if you have a file name stub in a variable that, in real filenames, is followed by two digits, which...
10,621
Posted By RudiC
32 bit overflow? Calculate 2^32 -...
32 bit overflow? Calculate


2^32 - 1841560902 = 2453406394


.
13,601
Posted By RudiC
No surprise. Shells don't expand variables...
No surprise. Shells don't expand variables enclosed in single quotes. Use awk's standard mechanism to convey variables: the -v option. Like
awk -F "," -v"USER=$usr" ' $1 == USER {print $2}'...
25,409
Posted By RudiC
Unfortunately, awk doesn't have the --recursive...
Unfortunately, awk doesn't have the --recursive option that grep provides. But we can resort to bash's "brace expansion" for sweeping across the directory tree and "extended globbing" ("extended...
10,551
Posted By RudiC
Run the ps $id outside the for hugepagesize ......
Run the ps $id outside the for hugepagesize ... loop. Same for the echo $total_num_hugepages. echo each result within. Adorn your echoes with the desired text.
74,098
Posted By RudiC
As ususal: what OS and shell versions? In...
As ususal: what OS and shell versions?


In (recent) bash, set the pipefail option:
$ set -o pipefail
$ ls -l fxxxx | tee -a file2 | tee file1
ls: cannot access 'fxxxx': No such file or...
8,440
Posted By RudiC
Try sort -t. -k1,1 -k2n file
Try
sort -t. -k1,1 -k2n file
14,393
Posted By RudiC
Looks like /usr/xpg4/bin/grep works as expected;...
Looks like /usr/xpg4/bin/grep works as expected; why not try /usr/xpg4/bin/awk, then?


For your other problem:
Remove the .log entry from filesdone upfront, with e.g. sed. Or do so with a...
11,720
Posted By RudiC
I'm afraid that sed script doesn't lead you...
I'm afraid that sed script doesn't lead you anywhere. Try
$ awk '/^Date/ {TMP = $2; next} /^Time/ {if (!HDDone++) print; next} !/^ *$/ {print TMP "_" $0}' file
Time Counter C00005A_1 C000B_1...
12,417
Posted By RudiC
Not sure why you should need cron for your task,...
Not sure why you should need cron for your task, but this should run under it as well. Make sure it is run by bash! Replace your if construct with
if [ $(ls ${error_dir} | grep -c "\.err$") -eq 0 ]...
14,393
Posted By RudiC
Why check for duplicate files if you can avoid...
Why check for duplicate files if you can avoid producing them in the first place? Try
$ touch filesdone
$ awk -vLCNT=10 -vPAT="CORRUPTION DETECTED" '
BEGIN {LCNT++
}...
12,417
Posted By RudiC
In the loop, will the .err files be removed on...
In the loop, will the .err files be removed on later success? How to tell new errors from old ones during the loop? Will there be leftovers from the last run?
What wait period between loops do you...
112,944
Posted By RudiC
Try also awk -v"T1=$text1" -v"T2=$text2" 'BEGIN...
Try also
awk -v"T1=$text1" -v"T2=$text2" 'BEGIN {PC = length(T1) / length (T2); print 100 * (PC<1?1/PC:PC) "%"}'
300%
Showing results 1 to 25 of 500

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