Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: RudiC
3,121
Posted By RudiC
Try awk ' ...
Try
awk '
{printf "%s\t", $0
}
...
2,827
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 <...
2,763
Posted By RudiC
Would this...
Would this (https://www.unix.com/303046306-post5.html) point you in the right direction to adapt your script?
2,690
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
4,097
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
4,097
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?
2,822
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...
2,827
Posted By RudiC
Better than what? Any attempts / ideas / thoughts...
Better than what? Any attempts / ideas / thoughts from your side?


This...
2,822
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...
2,754
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,...
2,822
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...
2,895
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...
2,423
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...
2,427
Posted By RudiC
32 bit overflow? Calculate 2^32 -...
32 bit overflow? Calculate


2^32 - 1841560902 = 2453406394


.
2,535
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}'...
2,798
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...
2,416
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.
3,052
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...
598
Posted By RudiC
Try sort -t. -k1,1 -k2n file
Try
sort -t. -k1,1 -k2n file
1,019
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...
2,707
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...
2,620
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 ]...
1,019
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++
}...
2,620
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...
3,448
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

 

Featured Tech Videos

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