And that means:
- # remove shortest part from beginning for matching *. - so for name="abc.def.gh" it removes the "abc." and returtns "def.gh", although "abc.def." is also matching the *.
So, this statement means - everything after first dot.
- % remove shortest part from end for matching .$suffix - So, it is removing suffix with dot from end, and returns beginning before .
Shorter it could be done with the same result by:
- but the suffix is used in final construction
The double % and # ( %% and ## ) means to remove longer matching, instead of shorter
Now the
means : get part before longer line of consecutive digits on end of the 'main'
: '+' - one or more repetition; [0-9] - any digits
and
- obviose is that just removed in previose statement string of digits
The statement num=10#${num} adds the base of the number. Othervise the '09' would be treated as 8-base number and rase an error (9 - is out of 0-7 digits)
Acctualy, last two statement before final file name construction could be done in that construction:
The '$((' and '))' define arithmetic calculation, '10#' before variable annonce the base for number.
Last edited by alex_5161; 11-05-2008 at 08:03 PM..
Dear Experts,
Please help to teach me how to add the filename into the file content so that i can get the output below:-
Actually the file name
***************New output that I want***************
=====2005-11-12=====
EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013... (2 Replies)
Dear Experts,
Please help to teach me how to add the filename into the file content.
Actually the file name are EVENTS-20050912.
***************New output that I want***************
EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013
EVENTS-20050912 12:10:28 ALARM: BTSSPAN-297-2... (1 Reply)
I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Hi
i need help in adding leading zero to filenames
e.g file name in my folder are
1_234sd.txt
23_234sd.txt
the output i need is
001_234sd.txt
023_234sd.txt
can i do this shell scripting
please help (2 Replies)
Hi,
I am a relative new bee in scripting. I need to develop a script such that the code would iterate through each file in a source directory and append every line of the file with '|' and the corresponding file filename.
eg
INPUT file IF927_1.dat -
H|abc... (4 Replies)
Hi ,
Can any one please tell me, how can we add the file name as column using sed.
right now we are using the below awk command for adding the file name as column but when we are calling this script from datastage it is deleting the file data..very weird raised a support ticket with datastage.... (2 Replies)
I needed some help in adding a duration (in seconds) to a start time (in hhmmss format) and a start date (in mmddyy format) in order to get an end date and end time. The concept of a leap year is also to be considered while incrementing the day. The code/ function that I have formed so far is as... (3 Replies)
Hello,
I am trying to create a file in windows and i want the filename to have timestamp as well but something is wrong and i can not understand waht. The code that i use is the following
($cwkday,$cmonth,$cday,$ctime,$cyear) = split(/\s+/, localtime);
$current_date =... (5 Replies)