![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cannot get logic for concatenation awk | user_prady | Shell Programming and Scripting | 7 | 12-10-2007 03:09 AM |
| File Concatenation | samit_9999 | UNIX for Dummies Questions & Answers | 3 | 11-21-2006 06:26 AM |
| string concatenation | systemsb | UNIX for Dummies Questions & Answers | 7 | 04-04-2006 01:03 PM |
| Implementing Concatenation(cat) | toughguy2handle | High Level Programming | 2 | 09-22-2005 03:10 AM |
| Concatenation | videsh77 | Shell Programming and Scripting | 2 | 12-14-2004 06:13 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Concatenation
How can I do this:
date = 4 -----------> 04 Month= 3-----------> 03 I wish to make a varibale named Var1 which will hold the value of current date and month value as: 2 digits for date. 2 digits for month. So finally var1 should hold value as 0403 --- MMDD |
|
||||
|
Quote:
Try this Code:
$DB_Date=sprintf("%02d%02d", $date, $Month);
|
|
||||
|
Code:
#!/bin/perl -w
use IO::Handle;
($day, $month, $year) = (localtime)[3,4,5];
$month=$month+1;
$year=$year+1700;
$DB_Date=printf("%02d%02d", $date, $Month);
open (dbfile, "/data1/scp/store/DB/0403/SCP_PP_SUBS.dat") or die "Couldn't get at THE FILE";
@data;
$credit;
$count =0;
print "DB_Date:: $DB_Date \n\n";
print "LESS then the 100 Credit $day/$month/$year\n\n";
print "-------------------------------------------\n";
while (<dbfile>)
{
........................
..........................
............................
...........................
Do some file parsing operation
}
print "Total Count: $count \n";
close dbfile;
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|