Sponsored Content
Top Forums Shell Programming and Scripting While file exists with specific extension Post 302314105 by devtakh on Thursday 7th of May 2009 11:22:12 AM
Old 05-07-2009
Try this: ( replace dir with the appropriate path)

Code:
today=$(date +"%j")
ind=0
for file in yourdir/*.txt; 
do 
new="2751$today$ind.dat"; 
mv $file $new
ind=$(( ind + 1 ));
done


cheers,
Devaraj Takhellambam
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get files with a specific extension

Hi All, How do I get only the files with the .csv extension. I have a shell script something like below: #!/usr/bin/ #Directory to scan for files SCANDIR="/cmb/data/exstream/scriptslogs/"; LOGFILE="/cmb/data/exstream/scriptslogs/test.log"; cd $SCANDIR for FILE in * ; do FILENAME=$FILE... (9 Replies)
Discussion started by: janavenki
9 Replies

2. Shell Programming and Scripting

Removing 0 from a specific position - if it exists

I have a file that I need to parse using a script. The dates in the file are displayed in the format: Mar 2, 2011 9:09:31 PM I have tried using the date command %e and %l but it pads an extra space for the day and hour if they are single digits. So this I used a normal date command: ... (6 Replies)
Discussion started by: crazyideas
6 Replies

3. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

4. Shell Programming and Scripting

Need help with if an extension exists in a certain repertory

Hi, I was wondering if you can help me with verifying if certain extension exists in /var/log with an if statement. Basically I'm trying to see if there is a .Gz extension in the repertory /var/log. My code: if ; then echo ¨ The extension exist¨ else echo ¨theres no extension¨ fi ... (2 Replies)
Discussion started by: Froob
2 Replies

5. Shell Programming and Scripting

Passinng specific file extension to while loop in ksh

hello, i have the below while loop wherein i am passig list of filenames to be scped. this is in unix ksh - filenamelist.txt has list of files names, including .dat and .txt files but i want to pass only the .txt filenames to the while loop so that only .txt files gets scped. how can... (4 Replies)
Discussion started by: billpeter3010
4 Replies

6. Shell Programming and Scripting

Remove only specific char on every line when exists

Hi I need to remove "|" char when it's the last char of the line. Input file: generoso|desprendido|altruista| abnegar|ceder|sacrificar| abocetado-da|esbozado| apuntado|insinuado|incompleto abocetar|esbozar|bosquejar| diseñar|delinear ------------------------ output need --- ... (11 Replies)
Discussion started by: lookoo
11 Replies

7. Shell Programming and Scripting

Delete all files with specific extension in directory tree

I'm sure this has been asked many times, but a search didn't turn up a definitive best method for this (if there ever is such a thing). I have been using rsync to back up my main data directory, but I have accumulated a large number of older backups that I don't need. All of the files I don't... (14 Replies)
Discussion started by: LMHmedchem
14 Replies

8. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies

9. Shell Programming and Scripting

Copy files based on specific word in a file name & its extension and putting it in required location

Hello All, Since i'm relatively new in shell script need your guidance. I'm copying files manually based on a specific word in a file name and its extension and then moving it into some destination folder. so if filename contains hyr word and it has .md and .db extension; it will move to TUM/HYR... (13 Replies)
Discussion started by: prajaktaraut
13 Replies

10. Shell Programming and Scripting

Bash to create sub directories from specific file extension

In the bash below I am trying to create sub-directories inside a directory from files with specific .bam extensions. There may be more then one $RDIR ing the directory and the .bam file(s) are trimmed (removing the extension and IonCode_0000_) and the result is the folder name that is saved in... (2 Replies)
Discussion started by: cmccabe
2 Replies
DTK_CREATE_COMPLEX_SHAPE(3)					Draw Toolkit manual				       DTK_CREATE_COMPLEX_SHAPE(3)

NAME
dtk_create_complex_shape - Creates or modify a shape to display custom and evolving content SYNOPSIS
#include <drawtk.h> dtk_hshape dtk_create_complex_shape(dtk_hshape shp, unsigned int nvert, const float *vertpos, const float *vertcolor, const float *texcoords, unsigned int nind, const unsigned int *ind, unsigned int type, dtk_htex tex); DESCRIPTION
dtk_create_complex_shape() creates a shape displaying a complex, custom and possibly evolving content described by vertex attribute buffers (vertpos, vertcolor and texcoords) and an array ind containing the indices of vertices whose order describes how to connect the vertices altogether in order to form primitives (controlled by type). tex can be used to specify a texture to be mapped onto the shape. vertpos should point to an array of nvert pairs of float values corresponding of the position (x,y) of each vertex. vertcolor should point to an array of nvert quatuples of float values corresponding of the color (R,G,B,A) of each vertex. texcoords can be either NULL or can point to an array of nvert pairs of float values corresponding to the texture coordinates (u,v) of the vertex. If texcoords is NULL, no texture will be used even if tex is not null. ind should point to an array of nind indices of the vertices in the vertex attribute buffers. This list of indices determines how the ver- tices form the primitives and depends on type zhich can take one the following value (See OpenGL manual to have detail): DTK_TRIANGLE_STRIP The first three vertices defines the first triangle (and their order is significant). Each subsequent vertex defines a new triangle using that point along with two vertices from the previous triangle. DTK_TRIANGLE_FAN A triangle fan is the same as a triangle strip with one exception: the first vertex of the list is always the first vertex of each triangle. DTK_TRIANGLES Separate triangles are specified. Every 3 indices defines in the order a triangle. If nind is not a multiple of 3, the excedent 1 or 2 indices are ignored. DTK_LINE_STRIP A series of one or more connected line segments is specified by enclosing a series of two or more endpoints. In this case, the ith index specifies the end point of the i-1st segment and the start point of the ith segment. DTK_LINES Individual line segments, each specified by a pair of vertices. If nind is odd, then the last index is ignored. shp can be used to modify a previously created shape. If it is non-null, the handle will be used to modify the shape referenced by shp: no new shape is created and the returned value is ensured to be shp in case of success, NULL otherwise. If shp is NULL, the function will attempt to create a new shape. The arrays vertpos, vertcolor, texcoords and ind are not copied into internal structures of the created shape. This allows one to dynami- cally change any aspect of the shape. However, in return it forces to keep the buffers allocated during the whole life time of the shape. RETURN VALUE
In case of success the function returns the handle to the newly created or modified shape. If the shp argument is non-null, the handle returned is the same value. In case of error, NULL is returned. THREAD SAFETY
The data contained into the buffers are accessed only during the creation and the draw of the shape. So if the data is updated in a differ- ent thread than the one used for drawing, some locking is needed. SEE ALSO
dtk_create_shape(3) EPFL
2010 DTK_CREATE_COMPLEX_SHAPE(3)
All times are GMT -4. The time now is 11:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy