Search Results

Search: Posts Made By: RudiC
10,531
Posted By RudiC
Would this...
Would this (https://www.unix.com/303046306-post5.html) point you in the right direction to adapt your script?
18,947
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...
12,559
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 <...
13,672
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...
18,947
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...
20,797
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,...
10,350
Posted By RudiC
32 bit overflow? Calculate 2^32 -...
32 bit overflow? Calculate


2^32 - 1841560902 = 2453406394


.
13,276
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}'...
24,921
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...
73,599
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...
14,134
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++
}...
112,275
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%
18,045
Posted By RudiC
Decimal numbers represented by a binary system...
Decimal numbers represented by a binary system are ALWAYS rounded / subject to rounding. For example, your first number, given as 0.123456789012, is internally approximated / stored as...
Forum: SCO 04-22-2020
38,982
Posted By RudiC
You have .ps - postscript - files, and you have...
You have .ps - postscript - files, and you have .eps - Encapsulated PostScript - files. That e stands for "encapsulated", is optional and shows that ps2pdf can work on both file types.
74,319
Posted By RudiC
You seem to have a problem with spaces in your...
You seem to have a problem with spaces in your listing yielding a code full of errors.
If all those corrected, use a "here document" for the remote commands. Like


ssh root@$ip <<EOF

#On...
78,728
Posted By RudiC
Those results may depend on the time that you...
Those results may depend on the time that you issue the find command. man find:
71,357
Posted By RudiC
I bet you have a P , a T , and a V file in...
I bet you have a P , a T , and a V file in your working directory, as ? is a "special pattern character" that "matches any single character" (cf man bash).
13,849
Posted By RudiC
man bash: So one [0-9] means one character...
man bash:

So one [0-9] means one character from (the range) 0 through 9.
5,426
Posted By RudiC
Show the compilation command including all error...
Show the compilation command including all error messages. One error is here:

formula2 =1/(1 + (x2^2)
For the rest the messages might help.
5,426
Posted By RudiC
My FORTRAN days are looooooong gone, but two of...
My FORTRAN days are looooooong gone, but two of the three "error coordinates" indicate the complier might not be happy with the ^ for exponentiation. I faintly remember it being ** in those old...
7,276
Posted By RudiC
How about - after removing the DOS line...
How about - after removing the DOS line terminators (<CR> = ^M = 0x0D = \r) that sabotage any regex -

grep -E "#[[:xdigit:]]{6}([[:xdigit:]]{2})?$" colours.txt
6,826
Posted By RudiC
Wouldn't some decent, representative input sample...
Wouldn't some decent, representative input sample data be wonderful?
Try
grep -o "nonce=['\"][^'\"]*['\"]" file
63,316
Posted By RudiC
I'm afraid you'll have to deploy the dangerous...
I'm afraid you'll have to deploy the dangerous and deprecated eval like

while read -r line
do eval echo "\${!$line
}: \${$line
}"
done < file1.txt
0 1 2: 1...
6,989
Posted By RudiC
Does your shell provide the select builtin?...
Does your shell provide the select builtin? Which, in combination with the case ... esac construct, helps building menus in a simple way.
40,402
Posted By RudiC
Try testing for "start-of-line nothing...
Try testing for "start-of-line nothing end-of-line":

echo "" | sed -n -r '/[0-9]{3}/{q100}; /^$/{q200}'; echo $?
200And, wouldn't it make sense to have different codes for different errors?
Showing results 1 to 25 of 500

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