rename in C-shell

November 9, 2010 at 02:01:23
Specs: Linux i686
how do I rename this files in C-shell.
GULT.BHZ.KO
GULT.BHE.KO
GULT.BHN.KO

ANTB.BHZ.KO
ANTB.BHE.KO
ANTB.BHN.KO

they have to be like this

2010-10031749_GULT.BHZ
2010-10031749_GULT.BHE
2010-10031749_GULT.BHN

2010-10031749_ANTB.BHZ
2010-10031749_ANTB.BHE
2010-10031749_ANTB.BHN


See More: rename in C-shell

Report •

#1
November 9, 2010 at 10:15:24
I will give you the pieces to the solution.

First, check out this link:

http://www.computing.net/answers/un...

Second, I do not recognize what 10031749 is. Is that Oct 3 at 1749?. Anyway, check the link and the date command for creating a time string.

This stub describes how you can build the destination file name:

#!/bin/csh

set datevar="2010-10031749_"
set myfile="GULT.BHZ.KO"

set destination=`echo ${datevar}${myfile}|sed 's&\.KO$&&' `
echo $destination



Report •

#2
November 9, 2010 at 12:55:39
yes ıt is a date. year- month day hour minute

Report •
Related Solutions


Ask Question