Search Results

Search: Posts Made By: bash-o-logist
2,143
Posted By bash-o-logist
# tested with bash 4 (regex 3.2+) [[ $string =~...
# tested with bash 4 (regex 3.2+)
[[ $string =~ ([[:alpha:]]+).[^[:alpha:]]*$ ]]
echo ${BASH_REMATCH[0]% *}
1,808
Posted By bash-o-logist
while read a b c; do echo $a; done <file
while read a b c; do echo $a; done <file
2,296
Posted By bash-o-logist
you are making it worse.
you are making it worse.
4,441
Posted By bash-o-logist
you can use file command's -i option. or...
you can use file command's -i option. or --mime-type
978
Posted By bash-o-logist
#!/bin/bash # tested on bash 4 shopt -s...
#!/bin/bash
# tested on bash 4
shopt -s nullglob
for files in index*html*
do
echo mv "${files}" "${files%.*}"
done
3,318
Posted By bash-o-logist
#!/bin/bash # tested on bash 4 while read...
#!/bin/bash
# tested on bash 4

while read -r -a array
do
for x in "${array[@]}"
do
case "$x" in
SLP_*) echo $x
esac
done
done < file
2,710
Posted By bash-o-logist
#!/bin/bash # bash 4 declare -i count=0 ...
#!/bin/bash
# bash 4
declare -i count=0
shopt -s globstar
shopt -s nullglob
for files in **/*
do
if [ -f "$files" ] ;then
if [ "${files##*/}" = "abc.txt" ];then
continue
...
10,369
Posted By bash-o-logist
Just try it out on the command line. It takes...
Just try it out on the command line. It takes less than 5 seconds to execute it than posting and waiting to get an answer. Put an "echo" in front of the rm command to see if your files are properly...
1,480
Posted By bash-o-logist
#!/bin/bash #tested with bash 4 ...
#!/bin/bash
#tested with bash 4

content=$(<file)
while [[ $content =~ Elapsed ]]
do
c=${content#*Elapsed}
case "${content%%Elapsed*}" in
*SQL*ERROR*)
echo...
2,296
Posted By bash-o-logist
you are just using shell commands inside Perl. !...
you are just using shell commands inside Perl. ! You do know that Perl is capable of string processing on its own, right? And why is your shebang !Perl ?
2,361
Posted By bash-o-logist
declare -i toggle=0 while read -r line do ...
declare -i toggle=0
while read -r line
do
case "$line" in
*Reference_Data*) toggle=1;;
esac
done < file
if [ $toggle -eq 0 ] ;then
echo "Not found"
else
echo "Found"
fi
1,763
Posted By bash-o-logist
#!/bin/bash # bash 4 tested declare -i num=0 ...
#!/bin/bash
# bash 4 tested
declare -i num=0
while read -r line
do
((num++))
if (( $num >50000 ));then
echo "$line"
fi
if (( $num == 100001 ));then
exit
...
1,966
Posted By bash-o-logist
#!/bin/bash # tested on bash 4 declare -i...
#!/bin/bash
# tested on bash 4
declare -i toggle=0
while read -r line
do
case "$line" in
*start*)
toggle=1
line="${line#start}"
;;
...
1,189
Posted By bash-o-logist
num=0 for files in *keyword* do cp $files...
num=0
for files in *keyword*
do
cp $files /destination && ((num++))
done
echo "how many files : $num"
7,802
Posted By bash-o-logist
#!/bin/bash # tested on bash 4 while read -r...
#!/bin/bash
# tested on bash 4
while read -r line
do
case "$line" in
*Mon\ *|*Tue\ *|*Wed\ *|*Thu\ *|*Fri\ *|*Sat\ *|*Sun\ *)
[[ $line =~...
1,473
Posted By bash-o-logist
You must have an old Solaris box.
You must have an old Solaris box.
1,473
Posted By bash-o-logist
for files in CRDT* do cp "$files"...
for files in CRDT*
do
cp "$files" "${files/CRDT/crdt_lon}"
done
27,232
Posted By bash-o-logist
#!/bin/bash # tested with bash 4 ...
#!/bin/bash
# tested with bash 4
file2=$(<file2)
while read -r line
do
case "$line" in
*NOVEMBER*)
line="$file2"
;;
esac
echo "$line"
done < file1 > t...
8,193
Posted By bash-o-logist
#!/bin/bash # tested on bash 4 shopt -s...
#!/bin/bash
# tested on bash 4
shopt -s globstar
shopt -s nullglob
numfiles=0
for files in **/*.xls
do
cp -p "$files" /destination
((numfiles++))
done
echo $numfiles
2,296
Posted By bash-o-logist
$> who|while read -r u; do echo "hello ${u%% *}"...
$> who|while read -r u; do echo "hello ${u%% *}" ;done
1,637
Posted By bash-o-logist
#!/bin/bash # bash 3.2+ declare -a array ...
#!/bin/bash
# bash 3.2+
declare -a array
while read -r line
do
array=( $line )
case ${#array[@]} in
10) echo "$line";;
esac
done < file > t
mv t file
2,987
Posted By bash-o-logist
#!/bin/bash # bash 3.2+ while read -r line ...
#!/bin/bash
# bash 3.2+
while read -r line
do
[[ $line =~ (Balance;.[^;]*) ]]
echo ${BASH_REMATCH[0]}
done < inputfile
1,177
Posted By bash-o-logist
#!/bin/bash # bash 3.2+ ex_byte=bb32 if [[...
#!/bin/bash
# bash 3.2+
ex_byte=bb32
if [[ $ex_byte =~ [a-z] ]];then
echo "Not ok"
elif [[ $ex_byte =~ [A-Z]+[0-9]+|[0-9]+[A-Z]+ ]] ; then
echo "ok"
fi




---------- Post...
Showing results 1 to 23 of 23

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