Search Results

Search: Posts Made By: daPeach
4,842
Posted By daPeach
did you try using a variable assigned from a pipe...
did you try using a variable assigned from a pipe in /bin/sh ?
825
Posted By daPeach
hi landrjos, do you know what the -n option...
hi landrjos,

do you know what the -n option stands for ?
4,842
Posted By daPeach
as "config" files are named after the functions...
as "config" files are named after the functions (or vice versa), you could use $FUNCNAME.
2,690
Posted By daPeach
ok, this doesn't appear in gawk's man, but it...
ok, this doesn't appear in gawk's man, but it does in mawk's

thank you
2,690
Posted By daPeach
awk permutations and combinations
hello,

I'm reading this thread (https://www.unix.com/shell-programming-and-scripting/154339-combinations-permutations.html), in which there is this code :awk '
function comb(v,i) {
for(i in...
1,184
Posted By daPeach
hi, forpackage in <list of packages> do ...
hi,
forpackage in <list of packages>
do
if <installed>
then <package ok>
else <nogo for package>; nogo=1
fi
done
test $nogo -ge 1 && exit 1why wouldn't you make the script to stop...
2,995
Posted By daPeach
Hi, no need of a shell script to do such a...
Hi,

no need of a shell script to do such a thing, grep can do it, alone.
2,079
Posted By daPeach
far less code : for i in 81UV78UV183UV89800 ...
far less code :
for i in 81UV78UV183UV89800 8U1UVV78UUV18UU3UV89800; do read -a ar <<<"${i//UV/ }"; printf '%s\n' "${ar[@]}"; done:D
14,656
Posted By daPeach
hi, like RudiC using parameter expansion,...
hi,

like RudiC using parameter expansion, but not format dependant:$ string="abc-def-1.2.3"
$ digits=${string//[^[:digit:]]/}
$ echo ${digits::1}
1
4,553
Posted By daPeach
hi, you need to give awk the date you want...
hi,

you need to give awk the date you want to output
awk 'BEGIN{s=41285.001469907409; d=mktime("2013 11 1 0 0 0");print strftime("%F - %T",d+s)}'
2013-11-01 - 11:28:05
2,673
Posted By daPeach
probably not a POSIX shell as the standard...
probably not a POSIX shell as the standard describes this situation and tells to use braces.
5,765
Posted By daPeach
eval is evil bash has got indirection$...
eval is evil

bash has got indirection$ var=VAR
$ VAR0=good
$ VAR1=excellent
$ for ((k=0; k < 2 ;k++)); do nv="$var$k"; echo "$nv = ${!nv}"; done
VAR0 = good
VAR1 = excellent
1,931
Posted By daPeach
bash 4
bash 4
1,931
Posted By daPeach
bash do support associative arrays. they only...
bash do support associative arrays.
they only need to be declared:declare -A assoAr
assoAr[subscript]="any value"
assoAr[aosubscript]="another value"
printf '%s\n' "${assoAr[@]}"
any value...
19,898
Posted By daPeach
hi, more probably, your .xls file is not an...
hi,

more probably, your .xls file is not an xls file.
what does answer ``file yourFile.xls'' ?

I've already downloaded files as .xls which were in fact html ones.
1,431
Posted By daPeach
without more specificationsd=6000000;for i in ...
without more specificationsd=6000000;for i in 100{1..3},{abc,ghkc,cbf} ; do printf '%s,%s\n' "$i" $((d++)); done
1001,abc,6000000
1001,ghkc,6000001
1001,cbf,6000002
1002,abc,6000003...
2,653
Posted By daPeach
hi, find $directory -type f -exec sed...
hi,

find $directory -type f -exec sed 's/'"$(sed ':r;N;$!;br;s/\n/\\|/g' enrollment.file)"'//g' \+
43,904
Posted By daPeach
hi, Shell & Utilities - Single UNIX...
hi,

Shell & Utilities - Single UNIX Specifications warns to not use them if script's input may be such strings.
I didn't find where it tells they're deprecated.

edit: or is it what means...
2,009
Posted By daPeach
an array seems useless in this casefor (( x=1;...
an array seems useless in this casefor (( x=1; x<=365; x++)); do printf -v maVar '%.2d' $x; command >1999$maVar; done
btw, arithmetic expansion is done inside array elements without the need of...
1,853
Posted By daPeach
hi, Does it really matters? No wise bash...
hi,

Does it really matters?
No wise bash coder will execute a bash script in any of this way as there is a shebang that tells the kernel to use bash as the command interpreter.
92,783
Posted By daPeach
hi, if you have gawk installed, this seems...
hi,

if you have gawk installed, this seems to work :echo "rdate NTPserver login 140 /var/log
rdate NTPserver login 121 /var/log" | \
awk '{var=$0; var=gensub(/[^[:digit:]*]/,"","g",var); if (...
3,594
Posted By daPeach
sorry, useless post. deleted.
sorry, useless post. deleted.
35,947
Posted By daPeach
based on jayan_jay's, here's a bash script : $...
based on jayan_jay's, here's a bash script : $ cat hexanumbers.txt
3E80
3EF8
460
$ while read hexnum; do array[16#$hexnum]="$hexnum"; done < hexanumbers.txt
$ printf '%s\n' "${array[@]}"
460...
2,524
Posted By daPeach
Hi shorter version:while IFS='/' read -ra...
Hi

shorter version:while IFS='/' read -ra Line
do printf '%8s %12s %12s\n' "${Line[@]}"
done < file
2,311
Posted By daPeach
Hi, here's some mawk :awk -F'|'...
Hi,

here's some mawk :awk -F'|' 'BEGIN{OFS="|"; RS=""} {gsub("\n"," ",$3); print}' file
Showing results 1 to 25 of 148

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