How to continue numbering after a regular expression has been found
Hello, I have a file starting with:
The problem is that, apart from the numbers shown, there are these headers found in the file multiple times. I want to construct a program that stores the position and the value, that means:
whenever you find a line, the numbering continues from the next line, that means:
I have constructed the following code:
Any help would be greatly appreciated!!!
Moderator's Comments:
Please use code tags when posting data and code samples!
---------- Post updated at 11:33 AM ---------- Previous update was at 11:29 AM ----------
I am sorry...the numbering starts from where it is indicated by the number stored in the field start, that is start = 200 etc...So this means:
200 0.987
etc
Last edited by vgersh99; 02-10-2011 at 12:32 PM..
Reason: code tags, please!
Since I am a newbie in programming, I would like to implement this in Perl...Does anybody have any idea how I could do that, or include this awk command in my Perl code???
Dear Help,
Is it possible to continue the loop by going to the next available value, if the 'expected value' is not found. I have a list of values which might not get incremented by fixed value and hence the loop could break and the script could terminate.
Any suggestion is appreciated.
... (1 Reply)
Hello All,
I'm trying to extract the lines between two consecutive elements of an array from a file.
My array looks like:
problem_arr=(PRS111 PRS213 PRS234)
j=0
while } ]
do
k=`expr $j + 1`
sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt
---some operation goes... (11 Replies)
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
I would like to print 3 lines after a regular expression is found in the logfile. I'm using the following code:
grep -n "$reg_exp" file.txt |while read LINE ;do i=$(echo $LINE |cut -d':' -f1 ) ;sed -n "$i,$(($i+3))p" file.txt ;done
The above code things works fine,but sometimes gives erroneous... (3 Replies)
CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error.
source $CA_VERSION_DATA
if * ]
then
echo "CA_RELESE $CA_RELEASE is invalid"
exit -1
fi
+ source /etc/ncgl/ca_version_data
++ CA_PRODUCT_ID=samxts
++ CA_RELEASE=6
++ CA_WEEK_NO=7
++... (3 Replies)
Hello All,
I am trying to write a script that will only continue executing my script if a file exits. I know the directory of the file, so its just a matter of seeing if the file exists yet. If the file has not yet been created, I want the script to wait 10 minutes (600 seconds) and try again.... (7 Replies)
Is it possible to combine a regular expression with a aritmetical expression? For example, taking a 8-numbers caracter sequece and casting each output of a grep, comparing to a constant.
THX! (2 Replies)