Search Results

Search: Posts Made By: pradeep_script
17,979
Posted By pradeep_script
shell script add each row value
vgersh99, rwuerth

awk '{sum += $1} END {printf "%.2f\n", sum}' file
-----
echo $(sed -e 's/$/+/' /tmp/cc) 0 | bc

Both command works.

thank you for your help.
17,979
Posted By pradeep_script
shell script add each row value
Hi,

I tried this, got it while search.

awk '{sum += $1} END {printf "%.2f\n", sum}' file..it gave the ans, but do not know if it correct..

vgersh99, can you explain the command?is this a...
17,979
Posted By pradeep_script
shell script add each row value
Hi,

I have modified the script:

FILE=/tmp/cc
SUM=0;
cat $$FILE | while reaad line; do
SUM=$SUM+$LINE;
done
echo $SUM;
exit 0;

but when I runn the script, it says "./cc.sh[6]: 0+38.08:...
17,979
Posted By pradeep_script
shell script add each row value
Hi,

I wrote below small script which will add up each row value from a file and print the total, but it is not.plz let me know what is wrong.script hangs and not displaying anything....
4,118
Posted By pradeep_script
character replace
I tired the below command, it worked.But doubt is would it replae only the first letter in each row with space

sed "s/A2009/ 2009/g".

franklin,

sed 's/^./ /', your command would do the same...
4,118
Posted By pradeep_script
character replace
Hi,

I have rows in a file, in each row string starts with "A200819097564".

I want to replace the first character A with space.So the string looks like " 200819097564"

I tried "tr -s "A2008"...
2,339
Posted By pradeep_script
history of a file
Hi every one,

Plz help me, what commands are helpful to know the complete history of a file in unix .
like, ls -lrt will give the group & user created & time last accessed.

I need to know...
1,917
Posted By pradeep_script
problem with if in shell
Hi,

I got the problem.

I did not give the space, between if & [.

Now the script is working.

Thank. you.
1,917
Posted By pradeep_script
problem with if in shell
Hi,

My sheel script has below statement:

if[ ! -z "`ps -fp $PID -o pid=,command=`" ]; then
When I run iam getting the below error:

-bash: syntax error near unexpected token `then'

What...
3,123
Posted By pradeep_script
script invoking shel script.
Hi,

I have a shell script which will start a process in my prodution server.

I want to write one more script as a cron job, which will start the first script at regular intervals.

My...
5,400
Posted By pradeep_script
Problem with script
SOrry..

I did not give execute permissions to the script.

Now I could run it.

Thank for all the replies & making me clear
5,400
Posted By pradeep_script
Problem with script
Iam trying to run this script.

But its saying,

"ksh: pradeep.sh: cannot execute"
5,400
Posted By pradeep_script
problem with grep
grep 'swi' file.txt | grep "DEV" | cut -f 6 >> f.txt

But with above command Iam getting the correct result.

When I did not use DEV with doube quotes, The grep is picking up the fields which has...
5,400
Posted By pradeep_script
problem with grep
oh...


Then wat is the difference b/w using single quotes & double quotes
5,400
Posted By pradeep_script
problem with grep
Hi,

So my understading so far is, if a searching pattern is a part of word, then we should keep it in single quotes. and if the searching pattern is itself a single word, we should keep it in...
5,400
Posted By pradeep_script
problem with grep
Hi,

Sorry to confuse you guys..

Ex:

123892TX ETV156SWI DEV 14 5:20 5:45 UBXS

Above record has 7 fields.
In above record, SWI is a part of field & DEV is separate field.
SO I have to...
5,400
Posted By pradeep_script
problem with grep
Hi,

file.txt list of records of fields.

grep 'swi' file.txt | grep "DEV" | cut -f 6 >> f.txt

In above command 'swi' word is a part of field.

SO I have to grep for that field which has 3...
5,400
Posted By pradeep_script
problem with grep.
This time I used the following command:

grep 'swi' file.txt | grep "DEV" | cut -f 6 >> f.txt

DEV word I kept in double quotes, as it should be single word, and this 3 letter word should not a...
5,400
Posted By pradeep_script
probem while grep
Hi ,

I used the floowing command in my script.

grep 'swi' file.txt | grep '^DEV' | cut -f 6 >> f.txt

Here file.txt contains fields of records.
My intension is to grep for the 3 letter 'swi'...
1,923
Posted By pradeep_script
problem with the script in counting
Hi Thanks for the reply.

I have one more doubt.
If I grabbed 2 or more fileds to the file and and If I want to count on only one more field...how the sort should be....
for example,

grep...
1,923
Posted By pradeep_script
problem with the script in counting
Hi,

I have a script which greps for a word in a file contains records.
I grabbed a particular column & sent the colomn values to a file.
I need to find each column value, the times it appeared...
Showing results 1 to 21 of 21

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