Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: disedorgue
Forum: Programming 01-29-2020
6,853
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...
3,133
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....
4,172
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. ...
4,172
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...
634
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...
4,634
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...
1,460
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...
2,119
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...
2,119
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,353
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,353
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//,/ }
1,449
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...
2,167
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...
2,158
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...
884
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,435
Posted By wisecracker
Merry XMAS, happy holidays etc. everybody...
Have a laugh...

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

Bazza...
5,265
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...
5,265
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,134
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...
4,688
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,506
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,274
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,274
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...
9,533
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,087
Posted By agent.kgb
logic error in your question.
logic error in your question.
Showing results 1 to 25 of 43

 

Featured Tech Videos

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