Sponsored Content
Top Forums Shell Programming and Scripting Shell program question with Filenames and dates Post 303014721 by SK123 on Monday 19th of March 2018 01:39:32 PM
Old 03-19-2018
The first few characters of the file name can vary. Few file names can have 8 letters and others may have 80 letters.

However it is the last 8 characters representing the date (before .csv) and to take the latest available dated file based on the run date.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

reading filenames inside a program

UNIX Sun Ultra60 5.5.1 Hello everybody, I have a problem that seems simple but turns out to be complex (for me at least). My program needs to open a directory (this part is easy), scan each filename and determine whether or not a file with the suffix (.07) exists. So the program would return... (5 Replies)
Discussion started by: j_t_kim
5 Replies

2. UNIX for Dummies Questions & Answers

While we are on the subject of dates. Another date question

This goes deeper into the date thing. I want to be able to check the date and time stamp in or on a file to see what the time span is. We have a job that runs several times an hour - kicked off through cron based on a trigger file. We want to keep track of each run and check the time between... (14 Replies)
Discussion started by: MizzGail
14 Replies

3. Shell Programming and Scripting

Awk question: Sum dates

Hi there, I have a logfile which has the following layout: 20080812 0 20 20080812 12 10 20080812 12 10 20080812 12 10 I want to sum the "12" on the last 3 lines and save the "20" on the first line. The final output should be 20080812 36 20 I think that should me more easier with... (6 Replies)
Discussion started by: BufferExploder
6 Replies

4. Shell Programming and Scripting

Question on reading dates in folders/files

Hi All, I have some folder that are named "FOLDERYYYYMM". I'm trying to piece together a .sh script that will look for the folder with the date. How can I get shell to see the date? (3 Replies)
Discussion started by: bbbngowc
3 Replies

5. UNIX for Dummies Questions & Answers

Question/review my script: removing bad chars from filenames

The task: remove undesirable characters from filenames. Restrictions: Must use basic RE, base utilities (non-GNU) and /bin/sh (ash). No ksh, zsh, perl, etc. Below is what I've come up with. It seems to work OK but I'm open to shorter, more efficient alternatives. Inside the square... (4 Replies)
Discussion started by: uiop44
4 Replies

6. Shell Programming and Scripting

Spaces in filenames located in variables in shell.

Greetings. I am trying to do a script that will do some file copying for me. Unfortunately I have spaces in the directory names (which I cannot change) and the result is someone hard to achieve in shell scripts. I have searched everywhere on the web but does not manage to find the answer to... (3 Replies)
Discussion started by: Mr.Glaurung
3 Replies

7. Shell Programming and Scripting

Filenames in CSH shell

Hi, I am running into a bit of a problem. I am trying to write a script that will run an interactive (fortran) program repeatedly to dump data across 36 data channels... anyway. I have gotten this far... #!/bin/csh set i=0 while ($i<2) fitsfilter $1<<EOF $i 0 9 1 1 g 2 1250 -100... (5 Replies)
Discussion started by: madtowneast
5 Replies

8. Shell Programming and Scripting

Awk program for calculating dates.

Hi All, I have a txt file which has hundreds of lines and 41 fields. I have a requirement to pick up field 14 from the text file which is a date fiels in the following format. Field 14 : Data Type : NUMERIC DATE (YYYYMMDD) Field Length : 8 Example of Data :20090415 Field 42 : Data Type... (2 Replies)
Discussion started by: nua7
2 Replies

9. Shell Programming and Scripting

Storing filenames in an array in shell script

hi, i am writing a shell script in which i read a line in a variable. FNAME="s1.txt s2.txt s3.txt s4.txt s5.txt" i want to create a array and store single file names in a array.. so the array should contain arr="s1.txt" arr="s2.txt" arr="s3.txt" arr="s4.txt" arr="s5.txt" how to... (3 Replies)
Discussion started by: Little
3 Replies

10. Shell Programming and Scripting

Help on Dates in Shell Scripting

Hi Experts, I am using the below code to get the previous day based on the date given as a input. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest Output: 20130714 How can i display the same output in 14/07/2013, i tired '+%d/%m/%y'` but i am getting... (16 Replies)
Discussion started by: learner24
16 Replies
CTYPE_LOWER(3)								 1							    CTYPE_LOWER(3)

ctype_lower - Check for lowercase character(s)

SYNOPSIS
bool ctype_lower (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are lowercase letters. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is a lowercase letter in the current locale. EXAMPLES
Example #1 A ctype_lower(3) example (using the default locale) <?php $strings = array('aac123', 'qiutoas', 'QASsdks'); foreach ($strings as $testcase) { if (ctype_lower($testcase)) { echo "The string $testcase consists of all lowercase letters. "; } else { echo "The string $testcase does not consist of all lowercase letters. "; } } ?> The above example will output: The string aac123 does not consist of all lowercase letters. The string qiutoas consists of all lowercase letters. The string QASsdks does not consist of all lowercase letters. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_alpha(3), ctype_upper(3), setlocale(3). PHP Documentation Group CTYPE_LOWER(3)
All times are GMT -4. The time now is 06:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy