Search Results

Search: Posts Made By: RudiC
5,657
Posted By RudiC
Would this...
Would this (https://www.unix.com/303046306-post5.html) point you in the right direction to adapt your script?
8,440
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...
6,399
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 <...
7,337
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...
8,440
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,346
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,...
5,102
Posted By RudiC
32 bit overflow? Calculate 2^32 -...
32 bit overflow? Calculate


2^32 - 1841560902 = 2453406394


.
7,112
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}'...
11,743
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...
43,280
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...
5,287
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++
}...
63,836
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%
11,129
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
28,634
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.
47,947
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...
47,315
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:
41,949
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).
6,599
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.
3,318
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.
3,318
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...
3,918
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
3,934
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
38,784
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...
3,790
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.
21,169
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 03:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy