Search Results

Search: Posts Made By: daPeach
5,358
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 ?
14,787
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,031
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...
1,514
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,069
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...
93,383
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 (...
2,558
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
1,424
Posted By daPeach
tmp1=Jane tmp2=Sue x=1 user=tmp$x echo...
tmp1=Jane
tmp2=Sue
x=1
user=tmp$x
echo ${!user}
Jane
x=2
eval user=\${tmp$x}
echo $user
Sue
2,347
Posted By daPeach
I don't know what you want to do, so I just...
I don't know what you want to do, so I just showed how to transform your filenames. You have to use cp or mv.

it's ${var:begin:length}, where begin is the beginning position, length is the number...
27,006
Posted By daPeach
no need of cutstring1=qwerWhatever ...
no need of cutstring1=qwerWhatever
s1f4=${string1:0:4}
echo $s1f4
qwerno need of sedstring2=qwerWhatever1
string3=${string2//$s1f4/}
echo $string3
Whatever1
1,328
Posted By daPeach
oh, no!! please, don't test a bash script calling...
oh, no!! please, don't test a bash script calling it with sh anyscriptit'll use sh as the interpreter
call it the proper way./anyscriptlet the shebang do its job
1,328
Posted By daPeach
#!/bin/bash #set deli = '|' deli="|" ...
#!/bin/bash

#set deli = '|'
deli="|"
#set ppattern = ""
#foreach i(`cat pattern`)
for i in $(<pattern)
#set ppattern = "$i$deli$ppattern"
do ppattern="$i$deli$ppattern"
echo $ppattern
#end...
2,806
Posted By daPeach
options=$(sed 's/\(.*\) *-r [^ ]*\(.*\)/\1\2/'...
options=$(sed 's/\(.*\) *-r [^ ]*\(.*\)/\1\2/' <<<"$@")
remHost=$(sed 's/.* *-r \([^ ]*\).*/\1/' <<<"$@")
ssh $remHost $options
1,203
Posted By daPeach
put patterns in a file (/tmp/patterns.txt)$ echo...
put patterns in a file (/tmp/patterns.txt)$ echo "$(</tmp/patterns.txt)"
510098810513720
510098810127652
510098810129898
510098810457113
510098810133736
510098811104417
510098810198601...
Showing results 1 to 14 of 14

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