Then the file is moved to different directory. In this directory might be a file, which already has a prefix 201208, eg. 201208_test.012_test.034.
So what I need to do, is create a file, which has a name like 201208_test.012_test.987.
What is the best way to do that? Thank you for your help and time.
#!/bin/ksh
cd TestNum;
TNoFiD=`ls -rtl | wc -l` #the Total Number of Files in the Directory.. keep in mind this also counts the total line in ls -rtl
TNoAFiD=$TNoFiD - 1 #we want to remove the total line, so Total No of Actual Files in Directory
FFN=`ls -rtl | head -2 | tail -1 | awk '{print $9}'` # First File Name
LFN=`ls -rtl | tail -1 | awk '{print $9}'` # Last File Name
DAM=`date +%Y%m` #Date And Month
desiredname="$DAM"_"$FFN"_"$LFN"
echo $desiredname
Last edited by ramky79; 10-02-2012 at 04:46 PM..
Reason: Code tags, please...
I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file.
I would like to output the lines of File2 which... (1 Reply)
Hello Everyone ,
Iam a newbie to shell programming and iam reaching out if anyone can help in this :-
I have two files
1) Insert.txt
2) partition_list.txt
insert.txt looks like this :-
insert into emp1 partition (partition_name)
(a1,
b2,
c4,
s6,
d8)
select
a1,
b2,
c4, (2 Replies)
I want to create an array which can store the strings from the user input in shell script .
example :-
I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
I'm trying to write a bash script to perform basic arithmetic operations but I want to run a comparison on the arguments first to check that they're a number greater than zero.
I want an error to pop up if the arguments args aren't >= 0 so I have:
if ! ]; then
echo "bad number: $1"
fi
... (14 Replies)
I have the following lines in a log file. It would be great if some one can help me to create a new file with the just entries in the below format.
66.150.161.195 HPSAC=Z05
66.150.161.196 HPSAC=A05
That is just extract the IP address and the string DPSAC=its value
66.150.161.195 -... (1 Reply)
The question is not as simple as the title... I have a file, it looks like this
<string name="string1">RZ-LED</string>
<string name="string2">2.0</string>
<string name="string2">Version 2.0</string>
<string name="string3">BP</string>
I would like to check for duplicate entries of... (11 Replies)
Hi All,
In one shell script I have
In variable "i" I am getting a full path of a file. Now I want to compare something like
-- upper(*Nav*))
I dont want to do like below because in each CASE statement I doing so many operations.
Please guide me.
Thanks in advance... (4 Replies)
Hi,
I need sample code to compare the two files line by line which contains text strings and to print the difference in the third file.
Thanks in advance (1 Reply)
I need some help with a script which accepts multiple rows of input (analysis from a virtual robot's testrun) from the standard in, and compares it as a whole with another file featuring erroneous data from a virtual robot's test run. What I want it to be able to do is slice off all the erroneous... (2 Replies)