Search Results

Search: Posts Made By: disedorgue
Forum: Programming 01-29-2020
10,522
Posted By LMHmedchem
Thanks for the suggestion, I did fix this error...
Thanks for the suggestion, I did fix this error but it did not resolve the issue.

I decided to move the assignment of archdir to after the definitions of ${BDIR} and ${TESTDIR}.

Now the revised...
7,790
Posted By MadeInGermany
Nice idea, delete and create! One can also use...
Nice idea, delete and create!
One can also use a { code block } that holds the input file open.
In this case one can even use the stdin (descriptor 0) instead of a descriptor 3....
7,783
Posted By Don Cragun
It might, or might not, be faster depending on...
It might, or might not, be faster depending on what hardware you're using, what operating system you're using, what version of perl you're using, and what other tools you're using as a comparison. ...
7,783
Posted By Corona688
How does that help? Perl is not magic, therefore...
How does that help? Perl is not magic, therefore it must decompress a file to seek inside it too.

This is because gzip doesn't have a "main dictionary" of symbols anywhere, just calculates...
947
Posted By MadeInGermany
Also I get different behavior with different awk...
Also I get different behavior with different awk versions. An unsuccessful getline gives different results. Better check its return status.
Some awk versions have a different opinion when a ($0) is...
6,488
Posted By Chubler_XL
After some more testing it appears that the 2 in...
After some more testing it appears that the 2 in and out FIFOs are needed to avoid some syncing issues which cause records to be missed. Update below reverts to using in0 in1 out0 and out1.

Using...
2,099
Posted By jim mcnamara
disedorgue's locale may have added a trailing "e"...
disedorgue's locale may have added a trailing "e"
to --to-commande.

Your locale may not support that. We have some linux boxes that are set to Spanish.
On those boxes, I mess up the spelling...
3,696
Posted By MadeInGermany
The for loop should end with a simple done. ...
The for loop should end with a simple done.
Indeed a for loop is made to cycle through a list in memory; if the list is made from a file then the whole file must fit into memory.
In contrast, a...
3,696
Posted By Scrutinizer
Try something like: while IFS=\| read s q x ...
Try something like:
while IFS=\| read s q x
do
printf "%s\n" "$s" "$q" "$x"
done < $file



--
Note: it is best to quote variable expansions to avoid interpretation by the shell:
echo "$s"
1,742
Posted By MadeInGermany
"The format is re-used as necessary to consume...
"The format is re-used as necessary to consume all of the arguments."
This trick repeats the format (which makes a line).
Unfortunately the variables in the format string must not contain %...
1,742
Posted By RudiC
I guess you meant to write printf "$a %s $c\n"...
I guess you meant to write
printf "$a %s $c\n" ${b//,/ }
2,578
Posted By MadeInGermany
The part after the -type f should be in...
The part after the -type f should be in (esccaped) brackets, otherwise it would attempt to rm an old *.gz directory.
Or this version that also eliminates a redundant -name '*.gz'
find $DIRECTORY...
4,366
Posted By Don Cragun
It seems that some Linux developers update code...
It seems that some Linux developers update code to meet some POSIX requirements without taking the time to update the corresponding man page. (Do not read this as a slur against Linux; it happens in...
3,958
Posted By Scrutinizer
@disedorgue. interesting trick with the GNU...
@disedorgue. interesting trick with the GNU e-modifier..
I think you need 0,/^unix/.... otherwise it seems to insert twice in case the first line starts with the pattern...
1,088
Posted By Aia
Hi looney, All the highlighted part is...
Hi looney,

All the highlighted part is pattern, so it will be the equivalent of:
NR > 1 && $0=B"#"A {print $0}
If every term of the pattern evaluates to true print the whole record. The...
Forum: What is on Your Mind? 12-24-2015
1,713
Posted By wisecracker
Merry XMAS, happy holidays etc. everybody...
Have a laugh...

https://www.youtube.com/watch?v=HZWQcl1C-c8

Bazza...
10,117
Posted By Don Cragun
If you're trying to learn how to use sed, you...
If you're trying to learn how to use sed, you should also learn to recognize things that sed was not designed to do (like counting lines backwards from the end of a file). A tool like ed or ex could...
10,117
Posted By MadeInGermany
Here comes a true sed solution sed ' 1{h;d;}...
Here comes a true sed solution
sed '
1{h;d;} # line 1, copy to hold space
2,3{H;d;} # lines 2..3, append to hold space, separated by \n
# all remaining lines
H # append to hold space
g # copy...
5,923
Posted By Scrutinizer
You're welcome. Yes, the for loop does not...
You're welcome. Yes, the for loop does not redirect stdin, whereas the while read loop does. stdin is needed by the ssh command, so ssh was complaining that stdin could not be used..
The adaptation...
10,088
Posted By Corona688
Greedy matching is doing you in. All...
Greedy matching is doing you in. All "(?!foobuzz)..." needs to find is one spot before user1 which doesn't start in 'f' and its condition is satisfied. The .* after it swallows everything. So it...
1,909
Posted By Scrutinizer
Bash 4 or higher: $ bash -c 'declare -A XX' ...
Bash 4 or higher:
$ bash -c 'declare -A XX'
bash: line 0: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
$ bash4 -c 'declare -A XX'
$
1,681
Posted By Don Cragun
Or: awk '{$10 = ($10 == 24) ? "Keyword1" : ($10...
Or:
awk '{$10 = ($10 == 24) ? "Keyword1" : ($10 == 8) ? "Keyword2" : ($10 == 0) ? "Keyword3" : $10}1' FS=, OFS=, file

Note that disedorgue was correct in noting that Scrutinizer's suggestion...
1,681
Posted By Scrutinizer
Yes, I see what you mean, if there is a...
Yes, I see what you mean, if there is a possibility that the keyword can be equal to the value, then that will influence the result. So it should only be used if that cannot happen, as appears to be...
21,406
Posted By Don Cragun
For a US English translation of the integers in...
For a US English translation of the integers in the range from 0 up to and including 999999999999999999999999999999999999 into ordinal numbers, you could try something like:
#!/bin/ksh
awk '
BEGIN...
1,407
Posted By agent.kgb
logic error in your question.
logic error in your question.
Showing results 1 to 25 of 43

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