1751974 Members
4647 Online
108784 Solutions
New Discussion юеВ

help easy

 
SOLVED
Go to solution
Jairo Campana
Trusted Contributor

help easy

Hi
I have a script
echo "input:" 8b 8c 8d
read $B
for i in $B
## the command #
pixar -p $B >log

the output : is invalid command
the option -p only accept one parameter
pixar -p 8b 8c 8d

since do it

and howto delete lines in log

cat.log

aaaaaaaa
bb
fd
jg
9sf9 ffff

a need deleted lines with space blank, line bb, fd jg


legionx
12 REPLIES 12
Michael Steele_2
Honored Contributor

Re: help easy

cd /dir/log
>log (* will zero out log but keep the file *)
touch log (* same as above *)
rm log (* deletes *)
Support Fatherhood - Stop Family Law
Jairo Campana
Trusted Contributor

Re: help easy

the log format in post no is correct
attach the log correct.
legionx
James R. Ferguson
Acclaimed Contributor

Re: help easy

Hi:

If I understand correctly, you want to delete lines with leading whitespace (tabs and/or spaces). One way is:

# perl -ne 'print unless m{^\s+}' file

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: help easy

read $B

This should be: read B

for i in $B
pixar -p $B >log

Did you want to do pixar for every value you read in B?

for i in $B; do
pixar -p $i >log"
done

Another solution to delete lines with leading spaces/tabs:
$ grep -v "^[ ]" log

Where the [] contains a space then a tab.
Or you can do the following for all whitespace:
$ grep -v "^[[:space:]]" log
Jairo Campana
Trusted Contributor

Re: help easy

Denis

echo $B is : 8b 8c 8d

but command pixar only accept one value

the correct command is
pixar -p 8b
.....
....

pixar -p 8b 8c d
invalid command

I need in B input value 8b 8c 8d
and the command pixar -p execute one value only

I cant send 8b 8c 8d to a file

so:
for i in `cat B.input`
do
...
pixar -p $i

I no want to create files

understant?


legionx
Jairo Campana
Trusted Contributor

Re: help easy

sorry , I solved problem in the for ...do

thansk
legionx
Jairo Campana
Trusted Contributor

Re: help easy

sorry , I solved problem in the for ...do

thanks
legionx
Peter Nikitka
Honored Contributor

Re: help easy

Hi,

read Dennis' solution again to see, that there is no need for a temporary file:
B='8a 8b 8c'
for i in $B
do print val=$i
done

results in an output of
val=8a
val=8b
val=8c

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Jairo Campana
Trusted Contributor

Re: help easy

Dennis I submit points 8
, I do not what post
You can try other post
legionx