05-15-2009
you can use tail to get the last line. then pipe to awk or cut with delimiter ":" and get the second field. that would be your number. store the result in a variable, then rename using mv. this is actually very simple, so try your best. if not sure, look at the man page or any relevant shell scripting resource for info.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I need to BCP out a table into a text file along with the table headers. Normal BCP out command only bulk copies the data, and not the headers.
I am using the following command: bcp database1..table1 out file1.dat -c -t\| -b1000 -A8192 -Uuser -Ppassword -efile.dat.err
Regards,... (0 Replies)
Discussion started by: shilpa_acc
0 Replies
2. Shell Programming and Scripting
have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies
3. Shell Programming and Scripting
I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile).
The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies
4. Shell Programming and Scripting
Hello friends!
Help me pls to write correct awk and grep statements for my task:
I have got files with name filename.txt
It has such structure:
Start of file
FROM: address@domen.com (12...890) abc
DATE: 11/23/2009 on Std
SUBJECT: any subject
End of file
So, I must check,
if this file... (4 Replies)
Discussion started by: candyme
4 Replies
5. Shell Programming and Scripting
Hi,
I am trying to rename multiple filenames in a UNIX directory matching a specific condition.
i=0
for file in `ls $filename`
do
echo "$file"
#echo $i
i=`expr $i + 1`
mv $src_dir/${file} $src_dir/${file}_${i}
done
But this code renames the filenames and... (9 Replies)
Discussion started by: chetancrsp18
9 Replies
6. UNIX for Dummies Questions & Answers
I have a text file with irregular spacing between values which makes it really difficult to manipulate. Is there an easy way to convert it into a space delimited text file so that all the spaces, double spaces, triple spaces, tabs between numbers are converted into spaces. The file looks like this:... (5 Replies)
Discussion started by: evelibertine
5 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
8. Shell Programming and Scripting
Hi
Am trying to move a file from one name to another
When I do "ls" to check for the moved filename
I can see the file but when I try the same with a script am unable..
I think am doing some pretty silly error.. please help..
toMove=`ls | grep -E "partition.+"`
mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies
9. Windows & DOS: Issues & Discussions
I have several files that are named like this "DotP_D14 - Verknüpfung"
They all have the " - Verknüpfung" in common.
I'd like to rename all of them to get rid of that last part.
Is this possible with DOS on windows ? (1 Reply)
Discussion started by: pasc
1 Replies
10. Shell Programming and Scripting
hi all,
trying this using shell/bash with sed/awk/grep
I have two files, one containing one column, the other containing multiple columns (comma delimited).
file1.txt
abc12345
def12345
ghi54321
...
file2.txt
abc1,text1,texta
abc,text2,textb
def123,text3,textc
gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies