To prevent misunderstandings - YOU should be on to something. With the starters given, you could test and adapt and fine tune them until suiting your needs, or come back here if you can't get to a satisfying solution. Also, the final solution could be posted so people can see/learn from them for future questions.
No doubt, I will be doing so. This response didn't infer anything other than just that, in response to shamrock.
To clarify, my current script is written in bash. As of yesterday, this script has been put on a slight hold, to address some high priority IT Security concerns. So I will not be editing my script and testing the suggestion this week.
To determine whether or not any field is valid and to determine whether or not fields are out of order, you first need to have a clear definition of your filename format and a clear definition of what contents are valid in each field. You have shown us three examples of (presumably valid) filenames:
and a valid filename format:
(which has hyphens and underscores that do not match any of the sample filenames). Are hyphens and underscores interchangeable? In addition to be field separators, are hyphens and underscores valid characters in some fields???
And then you tell us that one of four of the five fields in your valid filename format can be omitted (.tif always being required). But you don't tell us what happens to the field separators if a field is missing?
You tell us that years 1900 and going forward are valid. Is 10000 a valid year? Is 12345678901234567890 a valid year? Did you really mean that only years 1900-9999 are valid? Or, is there some other specific range of valid years?
You say it is an error if the orgnumber and the imagenumber are out of order, but you give us absolutely no indication of how to tell whether or not any number is a valid orgnumber nor how to tell whether or not any number is a valid imagenumber???
Please give us a clear definition of the requirements for each field including minimum and maximum numbers of characters in the field; a list of valid characters in each field; a clear statement of what the field separators are; and a clear specification of the exact format of a filename without a locationabbreviation, without a year, with out an orgnumber and without an imagenumber field.
Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly:
Required output:
01FB 10000000c97843a2 8C 0
01FB 10000000c96fb279 9C 0
22AF 10000000c97843a2 8C 0
22AF 10000000c975adbd ... (10 Replies)
cat file1.txt
field1 "user1":
field2:"data-cde"
field3:"data-pqr"
field4:"data-mno"
field1 "user1":
field2:"data-dcb"
field3:"data-mxz"
field4:"data-zul"
field1 "user2":
field2:"data-cqz"
field3:"data-xoq"
field4:"data-pos"
Now i need to have the date like below.
i have just... (7 Replies)
I have a set of files in path /ifx01/etldata/lmt/
a.xml
b.xml
I have to archive & move these files to path /ifx01/etldata/archive ,so that not even the original files should exists.
After acrhiving there should be no files in path /ifx01/etldata/lmt/ (6 Replies)
Hello All
I have a xml file with many sets of records
like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
also same file can be like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
<tag3>data2&data3</tag3>
Now i can grep & and replace with & for whole file but it will replace all... (4 Replies)
Dear unix gurus,
I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this:
adam peter
blah blah blah
blah blah blah
car
01 30 200
02 31 400
03 57 121
.. .. ..
.. .. ..
n y... (8 Replies)
Hey,
I have a WebDav directory mounted and everything seems fine except for one thing. All file/directory names appear in all UPPERCASE, when in actual fact they are lowercase on the remote machine.
For example:
foo/bar/baz.html on the remote host, appears on my local machine as... (0 Replies)
Hi,
I am running this is korn shell
cp $source/$fname $dest/dir && rm $source/$fname
This was returned:
rm: /dir/file not removed: No such file or directory
The file could be found in the $dest directory which meant the cp was success.
The above code is used in a for loop to move... (5 Replies)
Hi,
I am new to scripting. I need a script to sort and the records in a file and then split them into different files.
For example, the file is:
H1......................
H2......................
D2....................
D2....................
H1........................... (15 Replies)
I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves.
Also, the script should only move a file from /exports to... (6 Replies)
Greetings -
I am a newbie in shell scripts. I have been thru the whole forum but there has been no similar query posed.
The objective of my system is to have a unified filebase system. I am using RSync to synchronise files between the location & central server with both of them having the... (4 Replies)