Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
Ranked #2K
~5K People Reached
Favorite Forums
Favorite Tags

37 Posted Topics

Member Avatar for lml108
Member Avatar for jimjim56

[CODE]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[/CODE]

Member Avatar for radoulov
0
98
Member Avatar for jasminselvaraj

If you can quote your parameters: [code]% cat s #!/usr/bin/sh ls -l "$1" % ./s "pip po" -rw-r--r-- 1 sysadmin None 0 Sep 4 11:46 pip po[/code] Otherwise (assuming single parameter): [code]% cat s #!/usr/bin/sh ls -l "$*" % ./s pip po -rw-r--r-- 1 sysadmin None 0 Sep 4 11:46 …

Member Avatar for radoulov
0
196
Member Avatar for tanha
Member Avatar for eggi
0
196
Member Avatar for sjgriffiths

With ksh93, bash, zsh: [code][[ $VAR == L* ]]&&echo OK||echo KO[/code] For old shells use case: [code]case $VAR in L*) echo OK;;*)echo KO;;esac[/code]

Member Avatar for eggi
0
79
Member Avatar for sjgriffiths

Use nawk or /usr/xpg4/bin/awk on Solaris. [code]awk -F, '!x[$2,$4]++' input[/code]

Member Avatar for eggi
0
83
Member Avatar for programmer321

[QUOTE=programmer321;596958][..] Can u suggest me a solution for finding a list of missing number from a given range say between 1 and 120. [/QUOTE] [CODE]awk 'END { for (i=min; i<=max; i++) if (!(i in x)) print i } { x[$1] } ' min=1 max=120 file[/CODE]

Member Avatar for radoulov
0
319
Member Avatar for jedi_ralf
Member Avatar for Robbieg6
Member Avatar for Pichard

With bash,ksh93 and zsh: [code]$ 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 radoulov radoulov 4.0K 2008-01-29 15:00 G√ran_F_08024/ $ for d in *;do [ -d "$d" ]&&[ ! -d "${d//[§√^]/_}" ]&&mv "$d" "${d//[§√^]/_}";done $ ls …

Member Avatar for radoulov
0
104
Member Avatar for Dwasifar
Member Avatar for lookof2day

Or just: [code]$ awk '{print substr($0,index($0,v),length(v))}' v="$OK"<<<$HTML OK[/code] or [code]$ awk '{match($0,v);print substr($0,RSTART,RLENGTH)}' v="$OK"<<<$HTML OK [/code]

Member Avatar for ghostdog74
0
139
Member Avatar for spikywits

[code]printf "%s\n" "$(tail -1 fileA)">>fileB[/code] Or perhaps I misread the question :) Otherwise: [code]printf "%s\n" "$(grep -vf fileB fileA)">>fileB[/code]

Member Avatar for radoulov
0
117
Member Avatar for kilogul

[quote][...] a for loop splits on spaces [...][/quote] 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 the ARG_MAX limit.

Member Avatar for eggi
0
118
Member Avatar for jjamd64

[code]awk 'NF>1&&!x[$2]++{print $2}' FS="username=[^@]*@" logfile[/code] Use nawk or /usr/xpg4/bin/awk on Solaris.

Member Avatar for radoulov
0
88
Member Avatar for srikanth_dhondi

If you have zsh: [code]% n=0.1 % repeat 10 printf "%.2f\n" $((n+=0.1)) 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00 1.10 [/code] With ksh93: [code]$ n=0.1 $ for i in {1..10};do printf "%.2f\n" $((n+=0.1));done 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00 1.10[/code] Otherwise, if your shell doesn't …

Member Avatar for eggi
0
81
Member Avatar for jjamd64

[code]#!/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 a;do printf "+%s\n" "$a" done dig +short mail."$1"|while read ms;do case $ms in ([0-9]*) printf "%s\n" "-$ms";; (*) …

Member Avatar for radoulov
0
130
Member Avatar for ilikecheese

With Awk: [code]awk '/^Items/{sub(/Items purchased by /,"");store=$1} /^[0-9]/{printf "%s %s\n",store,$0}' FS=":" store-orders.txt>your_new_file.txt[/code] Use nawk or /usr/xpg4/bin/awk on Solaris.

Member Avatar for radoulov
0
113
Member Avatar for chunchuwar
Member Avatar for jason.bean

If I understand correctly all you need is just: [code]for prog in /myinfo/yourinfo/supplierinfo/*Collector.java;do progname="${prog##*/}" java -classpath "$CLASSPATH:." "${progname%.java}" done[/code]

Member Avatar for radoulov
0
184
Member Avatar for ashikin_8119

Who is giving you such assignments :) If the output should be really as the one you show: [code]sort -t" " -rk2.12,2.14 filename | awk ' /^1/ { sub(/1/, "2") } /^3/ { saved = $0 } /^0/ { $NF = ($NF FS saved) } { x[FNR] = $0 }END{ …

Member Avatar for ashikin_8119
0
108
Member Avatar for Gorilatsouk1

Assuming "127" as pattern to match and an input as the one posted above: [code]awk '/127/{$1=$1c;c++}1' A.txt>B.txt[/code] Note that $1=$1... will recalculate the current record and squeeze repeated FS characters. Use nawk or /usr/xpg4/bin/awk on Solaris.

Member Avatar for Gorilatsouk1
0
136
Member Avatar for dewey_witt

With zsh: [code]% set -- 03 32 156 4 593 2 033 490 5 12 % print ${${(n)@}[-1]} 593[/code] with sort: [code]$ numbers="03 32 156 4 593 2 033 490 5 12" $ set -- $(printf "%d\n" $numbers|sort -nr) $ printf "%d\n" "$1" 593 [/code]

Member Avatar for radoulov
0
103
Member Avatar for chunchuwar

[quote=chunchuwar;452027][...] Anyhow my requirement is that when a function is called if any error generated during the execution of function that should go to log file and depending on that error I should perform some test case and simultaneously I should be able to exit from function and in my …

Member Avatar for radoulov
0
93
Member Avatar for sgriffiths

[quote=sgriffiths;448515]Hello I have a string "c0024" How can i get rid of non numeric digits, so i am left with 0024 removed "c" [/quote] With bash/ksh93 and zsh: [code]% s="c0024" % echo "${s//[^0-9]}" 0024 [/code]

Member Avatar for radoulov
0
91
Member Avatar for asciiletters

[code]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 3] put\ put setpagedevice\ } ifelse' currentpagedevice /InputAttributes get 0 get dup null eq …

Member Avatar for asciiletters
0
115
Member Avatar for benjohnson

If you want the records that don't match also: [code]awk 'NR==FNR{x[$2]=$NF;next} $1 in x?$0=$0" "x[$1]:1' FS="[~ ]" file2 file1[/code] Without them: [code]awk 'NR==FNR{x[$2]=$NF;next} $1 in x?$0=$0" "x[$1]:0' FS="[~ ]" file2 file1[/code] Use nawk or /usr/xpg4/bin/awk on Solaris.

Member Avatar for radoulov
0
79
Member Avatar for jherrera

[quote=jherrera;440717] I try to make a script to move files that are not in use or open by another program or process. it is kind of cleanup script. I need to cleanup some log-files that are not in use by the programs. i know that they are tools to check …

Member Avatar for radoulov
0
94
Member Avatar for shlmsnger
Member Avatar for skelly16

[B]The Korn Shell (Unix and Linux Program Manual) (Paperback) [/B][URL]http://www.amazon.com/Korn-Shell-Linux-Program-Manual/dp/0201675234/ref=pd_bbs_sr_7/102-7008363-3924937?ie=UTF8&s=books&qid=1189623076&sr=8-7[/URL] [B]Learning the Korn Shell (2nd Edition) [/B][URL]http://www.amazon.com/Learning-Korn-Shell-Arnold-Robbins/dp/0596001959/ref=pd_bbs_sr_1/102-7008363-3924937?ie=UTF8&s=books&qid=1189623262&sr=1-1[/URL]

Member Avatar for skelly16
0
128
Member Avatar for arvindishukla
Member Avatar for harris2107

[code]$ cat file (ADDRESS = ( PROTOCOL = TCP ) ( HOST = 1.1 ) ( PORT = 1521 )) (ADDRESS=(PROTOCOL=TCP)(HOST=2.1)(PORT=1521)) (ADDRESS = ( PROTOCOL = TCP ) ( HOST = 3.1 ) ( PORT = 1521 )) $ awk '{x[++c]=$5}END{for(i=1;i<=c;i++)print "ip["i"]="x[i]}' FS="[=)] *" file ip[1]=1.1 ip[2]=2.1 ip[3]=3.1 [/code] Use …

Member Avatar for Fest3er
0
326
Member Avatar for srinivasocp
Member Avatar for rusman

[code]$ echo "a b c"|awk '$1=$1' OFS="-" a-b-c[/code] [code]$ echo "a b c"|awk '{print $1,$3}' OFS="-" a-c[/code]

Member Avatar for rusman
0
114
Member Avatar for jeromefong

[quote=jeromefong;391523] [...] I'm using read and for some reason, it is stripping the leading spaces off of each line. [...] [/quote] Consider this: [code]$ cat infile a a a $ while read;do while> echo "$REPLY" while> done<infile a a a $ while IFS= read;do echo "$REPLY" done<infile a a a …

Member Avatar for radoulov
0
169
Member Avatar for TheDonDon

Works for me, don't you want a command like this? [code]$ f='$usvol1.ssdxl' $ echo "gtacl -c 'files $f'" gtacl -c 'files $usvol1.ssdxl'[/code]

Member Avatar for TheDonDon
0
193
Member Avatar for slbit

The End.