Search Results

Showing results 1 to 40 of 54
Search took 0.01 seconds.
Search: Posts Made By: radoulov
Forum: Shell Scripting Mar 23rd, 2009
Replies: 3
Views: 520
Posted By radoulov
while IFS= read -r;do
printf '%s\n' "$REPLY"
done<regex.txt
Forum: Shell Scripting Mar 7th, 2009
Replies: 1
Views: 741
Posted By radoulov
du -ks /home/*/ 2>&- |
while read s d; do
u="${d%/}"
[ "$s" -gt 51200 ] &&
printf '%s: %d kb\n' "$d" "$s" |
mail -s "your home dir is too big ..." "${u#/home/}"
done
Forum: Shell Scripting Sep 7th, 2008
Replies: 6
Views: 2,568
Posted By radoulov
Yep, sorry!
It was a typo,
I meant:

echo "$*" >> jmj.txt
Forum: Shell Scripting Sep 5th, 2008
Replies: 6
Views: 2,568
Posted By radoulov
Try changing the shell script to:

echo "$#" >> jmj.txt
Forum: Shell Scripting Sep 4th, 2008
Replies: 6
Views: 2,568
Posted By radoulov
If you can quote your parameters:

% cat s
#!/usr/bin/sh

ls -l "$1"
% ./s "pip po"
-rw-r--r-- 1 sysadmin None 0 Sep 4 11:46 pip po

Otherwise (assuming single parameter):
Forum: Shell Scripting May 24th, 2008
Replies: 4
Views: 2,079
Posted By radoulov
Check this link (http://home.eol.ca/~parkw/index.html#httpd.sh).
Forum: Shell Scripting May 23rd, 2008
Replies: 2
Views: 776
Posted By radoulov
With ksh93, bash, zsh:

[[ $VAR == L* ]]&&echo OK||echo KO

For old shells use case:

case $VAR in L*) echo OK;;*)echo KO;;esac
Forum: Shell Scripting May 9th, 2008
Replies: 2
Views: 1,191
Posted By radoulov
Use nawk or /usr/xpg4/bin/awk on Solaris.

awk -F, '!x[$2,$4]++' input
Forum: Shell Scripting May 1st, 2008
Replies: 5
Views: 926
Posted By radoulov
awk 'END {
for (i=min; i<=max; i++)
if (!(i in x)) print i }
{ x[$1] }
' min=1 max=120 file
Forum: Shell Scripting Apr 30th, 2008
Replies: 8
Views: 5,963
Posted By radoulov
Did you test your code?
Do you get the expected result?
Forum: Shell Scripting Apr 29th, 2008
Replies: 8
Views: 5,963
Posted By radoulov
You could:

awk 'END {
print "#links:", _
for (i=1;i<=_;i++)
print la[i]
print "#images:", __
for (i=1;i<=__;i++)
print ia[i] }
{ r = $0
Forum: Shell Scripting Apr 28th, 2008
Replies: 8
Views: 5,963
Posted By radoulov
If you have GNU Awk:

awk 'END {
print "#links:", _
for (i=1;i<=_;i++)
print la[i]
print "#images:", __
for (i=1;i<=__;i++)
print ia[i] }
{ r = $0
Forum: Shell Scripting Apr 28th, 2008
Replies: 8
Views: 5,963
Posted By radoulov
Could you post a sample html input and the desired output?
Forum: Shell Scripting Feb 1st, 2008
Replies: 13
Views: 2,932
Posted By radoulov
Or, if you prefer:

bash 3.2.33(18)$ unset VHOME
bash 3.2.33(18)$ [ ! -n "$VHOME" ]&&echo '$VHOME is unset or null'||echo '$VHOME is:' $VHOME
$VHOME is unset or null
bash 3.2.33(18)$ VHOME=a...
Forum: Shell Scripting Feb 1st, 2008
Replies: 13
Views: 2,932
Posted By radoulov
bash 3.2.33(18)$ :"${VHOME:-$(echo "I'm your code">pippo)}"
bash 3.2.33(18)$ cat pippo
I'm your code
Forum: Shell Scripting Feb 1st, 2008
Replies: 13
Views: 2,932
Posted By radoulov
Or:

"${VHOME:-Empty, use this}"
Forum: Shell Scripting Jan 29th, 2008
Replies: 3
Views: 1,131
Posted By radoulov
find . -depth -type d -exec sh -c 'p="${1%/*}"
d="${1##*/}"
[ ! -d "$p/${d//[§√^]/_}" ]&&mv "$p/$d" "$p/${d//[§√^]/_}"' - {} \;
Forum: Shell Scripting Jan 29th, 2008
Replies: 3
Views: 1,131
Posted By radoulov
With bash,ksh93 and zsh:

$ ls -l
total 12K
drwxr-xr-x 2 radoulov radoulov 4.0K 2008-01-29 15:00 G^ran_F_080122/
drwxr-xr-x 2 radoulov radoulov 4.0K 2008-01-29 15:00 G§ran_F_08023/
drwxr-xr-x 2...
Forum: Shell Scripting Jan 15th, 2008
Replies: 3
Views: 2,940
Posted By radoulov
You'll find the answer here (http://www.grymoire.com/Unix/Quote.html).
Forum: Shell Scripting Jan 15th, 2008
Replies: 3
Views: 2,940
Posted By radoulov
Quote your variable: use "$line", not $line.
Forum: Shell Scripting Jan 15th, 2008
Replies: 3
Views: 11,162
Posted By radoulov
Or just:

$ awk '{print substr($0,index($0,v),length(v))}' v="$OK"<<<$HTML
OK

or
$ awk '{match($0,v);print substr($0,RSTART,RLENGTH)}' v="$OK"<<<$HTML
OK
Forum: Shell Scripting Jan 10th, 2008
Replies: 2
Views: 959
Posted By radoulov
printf "%s\n" "$(tail -1 fileA)">>fileB

Or perhaps I misread the question :)

Otherwise:

printf "%s\n" "$(grep -vf fileB fileA)">>fileB
Forum: Shell Scripting Dec 28th, 2007
Replies: 6
Views: 1,667
Posted By radoulov
The splitting would be caused by the unnecessary ls, if you use just globbing (for x in *"$ext" ...) that won't happen.
Of course, rm *.psd is the way to go, as long as the args size doesn't hit...
Forum: Shell Scripting Dec 21st, 2007
Replies: 2
Views: 1,986
Posted By radoulov
awk 'NF>1&&!x[$2]++{print $2}' FS="username=[^@]*@" logfile

Use nawk or /usr/xpg4/bin/awk on Solaris.
Forum: Shell Scripting Dec 13th, 2007
Replies: 5
Views: 1,668
Posted By radoulov
If you have zsh:

% n=0.1
% repeat 10 printf "%.2f\n" $((n+=0.1))
0.20
0.30
0.40
0.50
0.60
0.70
Forum: Shell Scripting Dec 12th, 2007
Replies: 3
Views: 2,918
Posted By radoulov
Line by line:

[ $# -ne 1 ]&&{
printf "Usage %s [%s]\n" "$0" "host"
exit 1
}

Test if the number of arguments supplied ($#) is not 1 (-ne stands for not equal),
if so (&& - if the previous...
Forum: Shell Scripting Dec 12th, 2007
Replies: 3
Views: 2,918
Posted By radoulov
#!/bin/sh
[ $# -ne 1 ]&&{
printf "Usage %s [%s]\n" "$0" "host"
exit 1
}
whois "$1"|fgrep "Name Server"|while read ns;do
printf "%s\n" "${ns# }"
done
dig +short "$1" mx|while read j...
Forum: Shell Scripting Dec 9th, 2007
Replies: 2
Views: 3,925
Posted By radoulov
With Awk:

awk '/^Items/{sub(/Items purchased by /,"");store=$1}
/^[0-9]/{printf "%s %s\n",store,$0}' FS=":" store-orders.txt>your_new_file.txt

Use nawk or /usr/xpg4/bin/awk on Solaris.
Forum: Shell Scripting Nov 27th, 2007
Replies: 1
Views: 2,401
Posted By radoulov
Forum: Shell Scripting Nov 27th, 2007
Replies: 3
Views: 2,582
Posted By radoulov
Strange,
what is the output of the following block on your system, here's mine:

$ ls -l myinfo/yourinfo/supplierinfo/*Collector.java
-rw-r--r-- 1 radoulov radoulov 0 2007-11-27 09:48...
Forum: Shell Scripting Nov 26th, 2007
Replies: 3
Views: 2,582
Posted By radoulov
If I understand correctly all you need is just:

for prog in /myinfo/yourinfo/supplierinfo/*Collector.java;do
progname="${prog##*/}"
java -classpath "$CLASSPATH:." "${progname%.java}"
done
Forum: Shell Scripting Nov 24th, 2007
Replies: 3
Views: 1,438
Posted By radoulov
Who is giving you such assignments :)

If the output should be really as the one you show:

sort -t" " -rk2.12,2.14 filename | awk '
/^1/ { sub(/1/, "2") }
/^3/ { saved = $0 }
/^0/ { $NF =...
Forum: Shell Scripting Nov 6th, 2007
Replies: 10
Solved: Replace
Views: 2,060
Posted By radoulov
On Solaris it should work with nawk and /usr/xpg4/bin/awk.

Tested with

/usr/bin/nawk:
SunOS 5.8 Generic 111111-04 Mar 2004

/usr/xpg4/bin/awk:
SunOS 5.8 Generic February...
Forum: Shell Scripting Nov 5th, 2007
Replies: 10
Solved: Replace
Views: 2,060
Posted By radoulov
Sed is not the right tool for this:

awk '/^127/{sub(/^127\./,"&"c" ");c++}1' A.txt
Forum: Shell Scripting Nov 5th, 2007
Replies: 10
Solved: Replace
Views: 2,060
Posted By radoulov
Assuming "127" as pattern to match and an input as the one posted above:

awk '/127/{$1=$1c;c++}1' A.txt>B.txt

Note that $1=$1... will recalculate the current record and squeeze repeated FS...
Forum: Shell Scripting Oct 18th, 2007
Replies: 3
Views: 1,398
Posted By radoulov
With zsh:

% set -- 03 32 156 4 593 2 033 490 5 12
% print ${${(n)@}[-1]}
593

with sort:

$ numbers="03 32 156 4 593 2 033 490 5 12"
$ set -- $(printf "%d\n" $numbers|sort...
Forum: Shell Scripting Oct 16th, 2007
Replies: 1
Views: 2,198
Posted By radoulov
The implementation depends on the shell you're using,
with recent versions of bash and with ksh93 you can use the pipefail option:
bash 3.2.25(1)$ f(){ ls "$@" 2>/dev/null||return $?;}
bash...
Forum: Shell Scripting Oct 12th, 2007
Replies: 2
Views: 2,899
Posted By radoulov
With bash/ksh93 and zsh:

% s="c0024"
% echo "${s//[^0-9]}"
0024
Forum: Shell Scripting Oct 2nd, 2007
Replies: 6
Views: 1,343
Posted By radoulov
You will get the modified output, you just have to save it,
or, if you have the GNU sed, you could use the -i switch to modify the file in-place.
Forum: Shell Scripting Oct 2nd, 2007
Replies: 6
Views: 1,343
Posted By radoulov
zsh 4.3.4% echo "Page 1 1"|sed '/Page 1 1/i\
currentpagedevice /InputAttributes get 0 get\
dup null eq\
{ pop }\
{ dup length 1 add dict copy\
dup /InputAttributes\
1 dict dup /Priority [0 1 2...
Showing results 1 to 40 of 54

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC