Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: daPeach
2,463
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 ?
544
Posted By daPeach
hi landrjos, do you know what the -n option...
hi landrjos,

do you know what the -n option stands for ?
2,463
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.
1,779
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
1,779
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...
933
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,039
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.
1,648
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
12,702
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
2,198
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
1,930
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.
4,092
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,504
Posted By daPeach
bash 4
bash 4
1,504
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...
16,369
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,131
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,192
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' \+
36,046
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...
1,703
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,669
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.
77,464
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,113
Posted By daPeach
sorry, useless post. deleted.
sorry, useless post. deleted.
30,942
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,174
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
1,520
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

 

Featured Tech Videos

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