Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: RudiC
1,649
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 <...
1,591
Posted By RudiC
Would this...
Would this (https://www.unix.com/303046306-post5.html) point you in the right direction to adapt your script?
1,680
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...
1,680
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...
1,560
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,...
1,711
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...
1,384
Posted By RudiC
32 bit overflow? Calculate 2^32 -...
32 bit overflow? Calculate


2^32 - 1841560902 = 2453406394


.
1,420
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}'...
1,638
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...
1,742
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...
646
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,140
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%
Forum: SCO 04-22-2020
1,667
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.
1,671
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...
2,061
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:
1,824
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.
1,266
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...
1,930
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).
1,573
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...
1,573
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.
1,661
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
1,825
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
2,686
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...
2,809
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?
2,136
Posted By RudiC
There was no count specified in your changed...
There was no count specified in your changed request in post #8. This is as close as I get towards your before last specification:
awk -F";" '
BEGIN {print HD = "vc_MessageInformation ...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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