This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Robert, Sure, a simple csh script could be: #!/bin/csh # assuming 4 letter station IDs beginning with "K" just to # not randomly grab files in a directory....but if nothing # else exists in the directory, then just `ls` would work. set FILES=`ls K*` foreach FILE ($FILES) echo "renaming $FILE" set SITE=`echo $FILE | cut -c1-4` set DATTIM=`echo $FILE | cut -c5-17` set NEWNAME=${SITE}_${DATTIM} mv $FILE $NEWNAME end Save the above to a file, and make it executable with "chmod a+x radarrename.csh" Then run it in your data directory. Steve Chiswell Unidata User SUpport On Wed, 2005-02-23 at 00:22, Robert Dewey wrote: > Hello, > > I downloaded NCDC Archived Level II data, and am having trouble > displaying it in gpnexr2. The problem is that NCDC uses a naming > conention like this: %SITE%YYYYMMDD_HHNNSS. > > Using the Unix command "rename", I can get the following convention: > %SITE%_YYYYMMDD_HHNNSS. The problem is that NCDC uses seconds at the > end of the filename. I tried adding a wildcard to the datatype.tbl > file: %SITE%_YYYYMMDD_HHNN*, but upon trying to view the data, gpnexr2 > tells me it can't find the station ID. Removing the last two "second" > variables from the filenames allows them to be displayed. I have close > to 150 files that need to be converted, and it would be a real pain to > do it by hand (I actually did most of it by hand, but then the "scour" > script came through and removed the files, *DOH*). > > So, is there an eaiser way around this file naming problem? > > > Thanks, > Robert Dewey