Search Results

Search: Posts Made By: nezabudka
120
Posted By nezabudka
probably shopt -s extquote
probably
shopt -s extquote
120
Posted By nezabudka
you can also read from a file into an associative...
you can also read from a file into an associative array
cat file
(
[apple]=123457
[mango]=123456
[orange]=1234567
)
declare -A arr
m=arr
eval $m=$(<file)
echo ${arr[@]}
1234567 123456...
246
Posted By nezabudka
cat .bashrc function salt { ... } typeset -x...
cat .bashrc
function salt { ... }
typeset -x -f salt
465
Posted By nezabudka
if grep -qiw "$name\|$number" teledir.txt; then ...
if grep -qiw "$name\|$number" teledir.txt; then
and with this design, 2 parameters are needed and not equal to an empty string
Otherwise
if [ $# -eq 1 ]; then
if grep -qiw "$name"...
465
Posted By nezabudka
if [ $# -eq 2 ]; then if grep -qiw...
if [ $# -eq 2 ]; then
if grep -qiw "$name\|$number" teledir.txt; then
echo "$name or $number exists"
fi
fi
176
Posted By nezabudka
remove echo echo cp $d FinalData/${d//\//_} ...
remove echo
echo cp $d FinalData/${d//\//_} #testing
cp $d FinalData/${d//\//_}
and insert test if need
if ! [ -e FinalData/${d//\//_} ]; then
cp $d FinalData/${d//\//_}
fi
176
Posted By nezabudka
Hi cd /tmp/user/Proj/V1/data/ find * -not...
Hi
cd /tmp/user/Proj/V1/data/
find * -not -path "FinalData/*" -name "*.csv" |
while read d; do
echo cp $d FinalData/${d//\//_};
done
436
Posted By nezabudka
Hi, try this if grep -qiw "$var1\|$var2"...
Hi, try this
if grep -qiw "$var1\|$var2" teledir.txt; then
echo $var1 or $var2 exist
elif grep -qiw "$var" teledir.txt; then
echo $var exist
fi
575
Posted By nezabudka
sed ':1;N;/\*/!b1;/FIRST\|THIRD/!d' logfile ...
sed ':1;N;/\*/!b1;/FIRST\|THIRD/!d' logfile

--- Post updated at 17:11 ---

sed -n '/2019\/10\/16/{:1;N;/}/!b1;/FIRST\|THIRD/p}' logfile
Forum: Shell Programming and Scripting 4 Weeks Ago
1,115
Posted By nezabudka
Hi You write to the file but check for...
Hi

You write to the file but check for readability
1,072
Posted By nezabudka
Hi There are probably commands in the script...
Hi
There are probably commands in the script running in the subshell. Try adding the wait command at the end
1,102
Posted By nezabudka
for TESTING in $(<TEST.tmp); do ...
for TESTING in $(<TEST.tmp); do
FIRSTID=$(echo -e "$TESTING")
echo -ne "$FIRSTID"
done > TESTING.txt
2,207
Posted By nezabudka
awk ' !($2 in t) {nl = NR; printf max $2...
awk '
!($2 in t) {nl = NR; printf max $2 FS $3 FS}
{t[$2]++; max = $3 FS t[$2] FS nl FS NR RS}
END {printf max}
' file
2,106
Posted By nezabudka
sed -n '1{h;b}; /Name/! {H;$!b}; x;s/\n/,/gp' file
sed -n '1{h;b}; /Name/! {H;$!b}; x;s/\n/,/gp' file
2,366
Posted By nezabudka
sed 's/\s\+\([[:alpha:]]\)/\1/' file
sed 's/\s\+\([[:alpha:]]\)/\1/' file
1,189
Posted By nezabudka
I think I understood Maybe so with a separator...
I think I understood
Maybe so with a separator for example a dot
echo $(<file.txt) | sed 's/\.\+/&\n/g'
1,189
Posted By nezabudka
Hi. try this tr -s '\n' ' ' <file.txt
Hi. try this
tr -s '\n' ' ' <file.txt
1,296
Posted By nezabudka
Maybe the reason is that the option "receive mail...
Maybe the reason is that the option "receive mail from untrusted sources" is not enabled on Google?
2,372
Posted By nezabudka
With this method, the mask for file names will...
With this method, the mask for file names will not be needed
[ "$(ls -A "$destination")" ] && exit
mv $(compgen -f "$derectory"/) "$destination"
1,533
Posted By nezabudka
awk '{u[$0]; l++} ENDFILE {print length(u), l,...
awk '{u[$0]; l++} ENDFILE {print length(u), l, FILENAME; delete u; l=0}' * | sort -k1,1n
2,891
Posted By nezabudka
GNU extension sed '/^$/Q' file
GNU extension
sed '/^$/Q' file
3,604
Posted By nezabudka
awk {gsub(",", "", $5); sum+=$5} END {print sum}'...
awk {gsub(",", "", $5); sum+=$5} END {print sum}' file
may be not "$5" field
awk {gsub(",", ""); sum+=$0} END {print sum}' file
3,604
Posted By nezabudka
Hi, did I understand correctly? awk -F, 'NR ==...
Hi, did I understand correctly?
awk -F, 'NR == 5 {for(i = 1; i <= NF; i++) sum+=$i; print sum}' file
294

--- Post updated at 10:30 ---

awk '{sum = 0; t = split($5, arr, ","); for(i = 1; i <=...
3,873
Posted By nezabudka
@Scrutinizer, then so, but it has have to forget...
@Scrutinizer, then so, but it has have to forget about the multi-line also
awk '!(length-1) {T = T (T?RS:"(") $1; printf "| " T ") " $1 FS; next} {print "| "$1}' RS=, <<<"A,B,C,D,E,G"
5,164
Posted By nezabudka
Maybe this will help? arr=(${arr[@]: -2}...
Maybe this will help?
arr=(${arr[@]: -2} ${arr[@]:0:$((${#arr[@]}-2))})
echo ${arr[@]}
Showing results 1 to 25 of 280

 

Featured Tech Videos

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