Sponsored Content
Full Discussion: Checking file extensions
Top Forums Shell Programming and Scripting Checking file extensions Post 302517779 by kristinu on Wednesday 27th of April 2011 07:09:00 PM
Old 04-27-2011
Checking file extensions

I am trying to store file with certain file extensions to list but having some problems.

Here is a part of the code

Code:
set fryLst = ""
set fxtLst = ""
foreach f ($AfullNameLst)
  set fname = $f:r
  set fext = $f:e
  if ("$fext" == ".ry") set fryLst = "$fryLst $f"
  if ("$fext" == ".xt") set fxtLst = "$fxtLst $f"
  set fnameLst = "$fnameLst $fname"
  set fextLst = "$fextLst $fext"
end

---------- Post updated at 06:09 PM ---------- Previous update was at 05:58 PM ----------

Fixed it, forgot that
fext did not include the "."
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File name extensions

Hello people, I was wondering if anyone could help me? I want to produce a shell script that changes the filename extension on all matching file. E.G. change all files called ‘something.rtf' to ‘something.doc' by giving the command: Changex rtf doc *where ‘Changex' is the name of... (2 Replies)
Discussion started by: thurrock
2 Replies

2. Shell Programming and Scripting

Truncate multiple file extensions

Hi, I have files with names like file1.txt.txt.txt.txt and file2.txt.txt.txt.txt.txt............ (random infinite number of .txt exist). how to truncate (mv) their names to ones with single .txt extension like file1.txt and file1.txt ? In other words, how to extract the filename upto first... (12 Replies)
Discussion started by: prvnrk
12 Replies

3. Shell Programming and Scripting

Batch changing file extensions

We are moving from an OpenVMS server to a Unix server and I have a problem with ftp'ing files. When I ftp the VMS server from the Unix server, I need to "mget" some files, for example "mget test_file*.txt;". The semicolon is necessary because OpenVMS has multiple versions of the file (eg... (5 Replies)
Discussion started by: cdines
5 Replies

4. Shell Programming and Scripting

file extensions in a directory structure

Hi, I have a huge directory structure with multiple directories and subdirectories in each of the directory. i am trying to find the various file extensions in the directory structure and put them into a file. is there any way through which i can accomplish this (4 Replies)
Discussion started by: itsritish
4 Replies

5. Shell Programming and Scripting

File extensions in a dir

Hi All, Is there a way to list all file extensions in a directory and its recursive dirs? Thanks (5 Replies)
Discussion started by: ganga.dharan
5 Replies

6. UNIX for Dummies Questions & Answers

Find all the unique file extensions

Hi How can i find the unique list of file extensions in a folder/subfolders e.g. MAIN/ a.txt b.txt a.clas a.java b.class a.txt.112 c.12.ram.jar i just need to get the below out irrespective of file being present in folder or subfolders txt clas java (5 Replies)
Discussion started by: reldb
5 Replies

7. Shell Programming and Scripting

Checking file extensions

I'm in csh and have a list of file names, example set Lst = "file1.ry file2.ry file3.ry file4.ry" I want to check if all the extensions are ry. Is they are, I want to do something. (1 Reply)
Discussion started by: kristinu
1 Replies

8. Shell Programming and Scripting

rename file, add extensions

Hi Guys, I have files named myfileaa,myfileab,myfileac,myfilesad.... till myfileav. Now i needs to rename all these files to myfileaa.txt ,myfileab.txt,myfileac.txt. Please help me how to do the same. Thanks in advance..!!! (4 Replies)
Discussion started by: jaituteja
4 Replies

9. Shell Programming and Scripting

Search for file extensions in the given directories

Hey guys, I'm lost... I need to make a script that will work in this way: ./script.sh -e sh /usr/bin /home/student this script will result in this output: amuFormat.sh /usr/bin gettext.sh /urs/bin perfect.sh /home/student the parameter -e <ext> gives you which... (2 Replies)
Discussion started by: Miki1579
2 Replies

10. Shell Programming and Scripting

Remove comments from file with specific file name extensions

Hello Unix board community, I have to program a shell script, but I am a complete noob so I hope I get some help here. The assignment is as follows: The program removes all comments regardless of formatting or language from files with specific file name extensions (php, css, js, ...).... (3 Replies)
Discussion started by: TheZeusMan
3 Replies
stcu(3) 						     Library Functions Manual							   stcu(3)

Name
       stcu,  st_cuinit,  st_setchdr,  st_currentpchdr,  st_free,  st_extadd, st_pext_iext, st_pext_rndx, st_iextmax, st_extstradd, st_str_extiss,
       st_idn_index_fext, st_idn_rndx, st_pdn_idn, st_rndx_idn, st_setidn - routines that provide a compilation unit symbol table interface

Syntax
       #include <syms.h>

       pCHDRR st_cuinit ()

       void st_setchdr (pchdr)
       pCHDRR	 pchdr;

       pCHDRR st_currentpchdr()

       void st_free()

       long st_extadd (iss, value, st, sc, index)
       long iss;
       long value;
       long st;
       long sc;
       long index;

       pEXTR st_pext_iext (iext)
       long iext;

       pEXTR st_pext_rndx (rndx)
       RNDXR rndx;

       long st_iextmax()

       long st_extstradd (str)
       char *str;

       char *st_str_extiss (iss)
       long iss;

       long st_idn_index_fext (index, fext)
       long index;
       long fext;

       long st_idn_rndx (rndx)
       RNDXR rndx;

       pRNDXR st_pdn_idn (idn)
       long idn;
       RNDXR st_rndx_idn (idn)
       long idn;

       void st_setidn (idndest, idnsrc)
       long idndest;
       long idnsrc;

Description
       The stcu routines provide an interface to objects that occur once per object, rather than once per file descriptor (for	example,  external
       symbols,  strings, and dense numbers).  The routines provide access to the current chdr (compile time hdr), which represents the symbol ta-
       ble in running processes with pointers to symbol table sections rather than indices and offsets used in the disk file representation.

       A new symbol table can be created with st_cuinit.  This routine creates and initializes a CHDRR (see cmplrs/stsupport.h).  The CHDRR is the
       current	chdr  and  is  used  in  all  later calls.  A chdr can also be created with the read routines (see The st_cuinit routine returns a
       pointer to the new CHDRR record.

       st_currentchdr Returns a pointer the current chdr.

       st_setchdr     Sets the current chdr to the pchdr argument and sets the per file structures to reflect a change in symbol tables.

       st_free	      Frees all constituent structures associated with the current chdr.

       st_extadd      Lets you add to the externals table. It returns the index to the new external for future reference and use.  The	ifd  field
		      for the external is filled in by the current file (see For more details on the parameters, see sym.h.

       st_pext_iext and st_pext_rndx
		      Returns  pointers  to  the  external, given a index referencing them. The latter routine requires a relative index where the
		      index field should be the index in external symbols and the rfd field should be the constant ST_EXTIFD. NOTE: The  externals
		      contain the same structure as symbols (see the SYMR and EXTR definitions).

       st_iextmax     Returns the current number of entries in the external symbol table.

       The iss field in external symbols (the index into string space) must point into external string space.

       st_extstradd   Adds a null-terminated string to the external string space and returns its index.

       st_str_extiss  Converts that index into a pointer to the external string.

       The  dense number table provides a convenience to the code optimizer, generator, and assembler. This table lets them reference symbols from
       different files and externals with unique densely packed numbers.

       st_idn_index_fext
		      Returns a new dense number table index, given an index into the symbol table of the current file (or if  fext  is  set,  the
		      externals table).

       st_idn_rndx    Returns  a  new dense number, but expects a RNDXR (see sym.h to specify both the file index and the symbol index rather than
		      implying the file index from the current file.  The RNDXR contains two fields: an index into the externals table and a  file
		      index rsyms can point into the symbol table, as well). The file index is ST_EXTIFD (see stsupport.h) for externals.

       st_rndx_idn    Returns a RNDX, given an index into the dense number table.

       st_pdn_idn     Returns a pointer to the RNDXR index by the idn argument.

See Also
       stfe(3), stfd(3)

								       RISC								   stcu(3)
All times are GMT -4. The time now is 07:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy