08-11-2011
?? Somebody or something has to count - else how would you know with which value you'll have to substitute the old value with? For this, Alister's solution should be better suitable than mine, especially for big files.
But if you already know how many lines there are minus the header and footer, you can just substitute the value in the last line directly.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hii to all..
I have a file stud.lst
bash-3.1$ cat stud.lst
NO NMAE DOB 10 +2 BE AVG
075 syam saksena 12/12/55 500 398 550 48.26
099 sachin 11/05/47 450 500 600 51.66
300 mohan kumar 19/04/43 500 600 700 60.00
100 john 12/12/52 800 750 700 75.00
125... (2 Replies)
Discussion started by: krishnampkkm
2 Replies
2. UNIX for Dummies Questions & Answers
Hi. I have a basic script in python that outputs like this..
$ ./test.py
1%
2%
3%
4%
5%
6%
7%
8%
9%
10%
...
But how can I make it so the output stays in 1 line?
So it would look something like this..
$ ./test.py
10% (1 Reply)
Discussion started by: cbreiny
1 Replies
3. Shell Programming and Scripting
Dear all,
I'm trying to write a script where:
A file contains more or less 2000 lines. To some of those lines, in a specific position, let's say 89-92 there are spaces. So, this script should find these spaces on specific position and update a value (from 2 to 1) to another position of the... (4 Replies)
Discussion started by: paniklas
4 Replies
4. Shell Programming and Scripting
Hi everyone
i need one help don't know whether it is simple or difficult but not able to solve it.
here is the problem
suppose my code is
time_def=3
r=0
while ]
do
echo "time left is $time_def "
((time_def=time_def-1))
done
and the output is
time left is 3
time left... (6 Replies)
Discussion started by: aishsimplesweet
6 Replies
5. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
6. Shell Programming and Scripting
my requirement is,
consider a file output
cat output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
this doesnt look good
et cetc etc
etcetera
i want to replace a line of line number 4 ("this doesnt look good") with some other line
... (3 Replies)
Discussion started by: vivek d r
3 Replies
7. Shell Programming and Scripting
Hi all,
I have a file called "text.cpp" with the first line of "1"
afterwards I tried in Ubuntu to type the following
sed '12iasdasdasdasdsad' test.cpp > output.txt
however when I tried to see the result of output.txt
#cat output.txt
1
why is the line 12 is not updated to the... (6 Replies)
Discussion started by: peuceul
6 Replies
8. Shell Programming and Scripting
Hi,
I have a xml file that I need to modify 1 line to change some value from 2 to 10 (or any number).
Sample input:
<!-- some text here>
.
.
.
<message:test name="ryan">
<message:sample-channel charset="UTF-8" max-value="2" wait="20">
... (5 Replies)
Discussion started by: brichigo
5 Replies
9. Shell Programming and Scripting
I have a file and need to update the specific position on line two. I tried to use this solution under the post "Awk command to replace specific position characters"
But need a way to just limit to update the line 2 and not every line on the file.
awk 'function repl(s,f,t,v) { return... (1 Reply)
Discussion started by: Sandeep
1 Replies