Search Results

Search: Posts Made By: rugdog
2,822
Posted By rugdog
the following command should work: egrep -i...
the following command should work:

egrep -i -f patterns file

do you get an error? or why do you say it doesn't handle the "-i"?
1,853
Posted By rugdog
the "sed" pattern should be: sed...
the "sed" pattern should be:

sed "s/param2=//"

hence, the second line should look like:

dir=$(cat tmp/app.conf | grep param2 | sed "s/param2=//")

otherwise the dir variable has the "=" at...
5,289
Posted By rugdog
here's the code with some comments to try to...
here's the code with some comments to try to explain...i hope it helps..



$str=shift @ARGV;
while(<>){
# match function name and save name and line to display later in
# case...
13,414
Posted By rugdog
do you want to make those assignments in the file...
do you want to make those assignments in the file as perl variables? if so id' do this:


open(F,'properties') or die "failed to open file $!\n";
while (<F>){
($name,$val)=m/(\w+)\s*=(.+)/;
...
5,289
Posted By rugdog
try this version $str=shift @ARGV; ...
try this version


$str=shift @ARGV;
while(<>){
if(!$sw && /(.+\(.*\))/){
$func_name=$1;
$func_start=$.;
$sw=1;
...
5,289
Posted By rugdog
try this - put this code in a file called...
try this

- put this code in a file called script.pl or whatever you like:

$str=shift @ARGV;
while(<>){
$c++ if $sw && /\{/;
$c-- if $sw && /\}/;
if($sw && $c==0){
...
20,033
Posted By rugdog
sort file|uniq -c although the output is...
sort file|uniq -c

although the output is different, but you could do, to get the desired format:

sort file|uniq -c|awk '{print $2 " : " $1}'
3,110
Posted By rugdog
maybe with perl like this: pwd|perl...
maybe with perl like this:

pwd|perl -ne'm/(.+apache)\/{0,1}/;print "$1\n"'

of course 'pwd' can replaced with anything that outputs the directory name or a list of directory names.
12,741
Posted By rugdog
in the case of substituting a env var, do an...
in the case of substituting a env var, do an export of the var, before the script:

export VAR=12.12.12.12.

perl -i -ne's/(ip=.+)(ip=.+?,)/$1ip=$ENV{VAR},/;print' file

as for adding back ...
12,741
Posted By rugdog
that would be: perl -i...
that would be:

perl -i -ne's/(ip=.+)(ip=.+?,)/$1/;print' file

be aware that the "-i" option is the in-place edit option of perl, that means that the file is modified right away when you run the...
12,741
Posted By rugdog
i'd do it with perl: perl -i...
i'd do it with perl:

perl -i -ne's/(ip=.+)(ip=.+?,)/$1ip=new.ip.address,/;print'

---------- Post updated at 02:13 PM ---------- Previous update was at 02:12 PM ----------

sorry forgot to...
4,037
Posted By rugdog
actually .forward can pipe the message through a...
actually .forward can pipe the message through a program, you just need to:

1. copy the script file in /etc/smrsh
2. edit the .forward file to have:

| /etc/smrsh/yourscript.sh

notice the...
Forum: Solaris 03-29-2010
21,608
Posted By rugdog
try this perl command: ls |perl...
try this perl command:

ls |perl -ne'chomp;($d,$m,$y)=(localtime((stat($_))[9]))[3,4,5];printf "$_ %4d%02d%02d\n",$y+1900,$m,$d'

or you can try the stat command, but i'm not sure if it exists...
16,627
Posted By rugdog
just put the two expressions in the same line of...
just put the two expressions in the same line of the ls, like this:

filelist=`ls -tr $currentDir/[C]*.#finished# $currentDir/[C]*.finished`
3,090
Posted By rugdog
can you post the contents of $filter_list right...
can you post the contents of $filter_list right before the find? perhaps with an echo $filter_list
1,694
Posted By rugdog
i there's little you can do to prevent your users...
i there's little you can do to prevent your users to use:

./configure --prefix=/some/path

or ./configure alone...

wouldn't be easier to instruct your users to alwasy use...
Forum: Programming 08-03-2009
2,367
Posted By rugdog
you could do a symlink ln -s /path/xyz.sh...
you could do a symlink

ln -s /path/xyz.sh /path/abc

or a hard link if they are in the same filesystem

ln /path/xyz.sh /path/abc

the path of abc can be the same or anyother different from...
5,032
Posted By rugdog
try issuing the command along with the full file...
try issuing the command along with the full file path

df -T /path/of/the/file

the -T works for linux, not sure what would work on the various unix flavors... which one are you on?
1,709
Posted By rugdog
#! /bin/ksh for i in `ls art_bg_11*` do ...
#! /bin/ksh
for i in `ls art_bg_11*`
do
temp=$i
mv $i $i.bkup
perl -ne'$l=100-length($s);if($l<=100){ m/^(.{0,$l})/s;$s.=$1;} END{ print $s."\n"}' $i.bkup >> $temp
rm $i.bkup
echo $i...
Showing results 1 to 19 of 19

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