Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Renaming of multiple filenames Post 76429 by matrixmadhan on Tuesday 28th of June 2005 09:47:16 AM
Old 06-28-2005
hi,

you can try this,

as far i had tested it works,
plz let me know if there are any errors or anything to be clarified

-----------------------------------------------------
for i in `ls flat*`
do
echo $i > cls
val=`awk '{print substr($i,length($i)-2,3);}' cls`
mv $i file`expr $val + 0`
done
rm -f cls
exit 0
-----------------------------------------------------
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Renaming of multiple filenames

Hi All, I need to rename the multiple file names. I need to rename for example as follows bas100e1_jun05 to FLAT1 bas100e2_jun05 to FLAT2 bas100e18_jun05 to FLAT18 Please not that I can cut_jun05 from the filename. Madhan had helped with a similar kind of script. But this is a new... (4 Replies)
Discussion started by: shashi_kiran_v
4 Replies

2. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies

3. Shell Programming and Scripting

Renaming Movies (or Flipping Portions of Filenames Using sed or awk)

Hey folks My problem is simple. For my first stash of movies, I used a naming convention of YEAR_MOVIE_NAME__QUALITY/ for each movie folder. For example, if I had a 1080p print of Minority Report, it would be 2002_Minority_Report__1080p/. The 2nd time around, I changed the naming convention... (4 Replies)
Discussion started by: ksk
4 Replies

4. UNIX for Dummies Questions & Answers

renaming filenames

I have 7 files with 7 different names coming into a specified folder on weekly basis, i need to pick a file one after another and load into oracle table using sql loader. I am using ksh to do this. So in the process if the file has error records and if sql loader fails to load into oracle tables,... (0 Replies)
Discussion started by: vpv0002
0 Replies

5. Shell Programming and Scripting

mass renaming files with complex filenames

Hi, I've got files with names like this : _Some_Name_178_HD_.mp4 _Some_Name_-_496_Vost_SD_(720x400_XviD_MP3).avi Goffytofansub_Some name 483_HD.avi And iam trying to rename it with a regular pattern. My gola is this : Ep 178.mp4 Ep 496.avi Ep 483.avi I've tried using sed with... (8 Replies)
Discussion started by: VLaw
8 Replies

6. Shell Programming and Scripting

Renaming files & folder according to the similarities in filenames

hello does someone want to help me for this one ? i want to rename files & a folder according to the similarities in filenames for example : the file with the good name cglogo tougl1953 dgmel bogd 01 -- ttgductoog ggdté gollogtd.ext1the others files needed to be renamed cglogo... (5 Replies)
Discussion started by: mc2z674gj
5 Replies

7. Shell Programming and Scripting

Grep and replace multiple strings in a file with multiple filenames in a file

Hi, I have a file containing list of strings like i: Pink Yellow Green and I have file having list of file names in a directory j : a b c d Where j contains of a ,b,c,d are as follows a: Pink (3 Replies)
Discussion started by: madabhg
3 Replies

8. Shell Programming and Scripting

Renaming Filenames by replacing a part

Hi, I have little experience on Shell scripts, I searched the forum but couldn't make out what I want. I want to rename a set of files to a new file name a_b_20100101 c_d_20100101 ....................... ...................... I want to rename the files to a_b_20140101... (5 Replies)
Discussion started by: JaisonJ
5 Replies

9. UNIX for Dummies Questions & Answers

Is there any way to cat multiple files and show filenames?

Hi, Is there any way to do a cat * where it shows the name of each file in the process? Similar to what more does below? $ more ?.sql :::::::::::::: 1.sql :::::::::::::: set linesize 200 select db_unique_name, cast( from_tz( cast(... (5 Replies)
Discussion started by: newbie_01
5 Replies

10. Shell Programming and Scripting

Renaming files with Spaces in Filenames

Entry level scripter. Any help appreciated. for file in *; do rename '4321_' '' $file ; done Doesn't work for files with spaces in between FOr eg 4321_1004.dat is renamed to 1004.dat but 4321_1004 2008.dat stays the same (1 Reply)
Discussion started by: davnavin
1 Replies
KOBJ(9) 						   BSD Kernel Developer's Manual						   KOBJ(9)

NAME
kobj -- a kernel object system for FreeBSD SYNOPSIS
#include <sys/param.h> #include <sys/kobj.h> void kobj_class_compile(kobj_class_t cls); void kobj_class_compile_static(kobj_class_t cls, kobj_ops_t ops); void kobj_class_free(kobj_class_t cls); kobj_t kobj_create(kobj_class_t cls, struct malloc_type *mtype, int mflags); void kobj_init(kobj_t obj, kobj_class_t cls); void kobj_delete(kobj_t obj, struct malloc_type *mtype); DEFINE_CLASS(name, kobj_method_t *methods, size_t size); DESCRIPTION
The kernel object system implements an object-oriented programming system in the FreeBSD kernel. The system is based around the concepts of interfaces, which are descriptions of sets of methods; classes, which are lists of functions implementing certain methods from those inter- faces; and objects, which combine a class with a structure in memory. Methods are called using a dynamic method dispatching algorithm which is designed to allow new interfaces and classes to be introduced into the system at runtime. The method dispatch algorithm is designed to be both fast and robust and is only slightly more expensive than a direct function call, making kernel objects suitable for performance-critical algorithms. Suitable uses for kernel objects are any algorithms which need some kind of polymorphism (i.e., many different objects which can be treated in a uniform way). The common behaviour of the objects is described by a suitable interface and each different type of object is implemented by a suitable class. The simplest way to create a kernel object is to call kobj_create() with a suitable class, malloc type and flags (see malloc(9) for a description of the malloc type and flags). This will allocate memory for the object based on the object size specified by the class and ini- tialise it by zeroing the memory and installing a pointer to the class' method dispatch table. Objects created in this way should be freed by calling kobj_delete(). Clients which would like to manage the allocation of memory themselves should call kobj_init() with a pointer to the memory for the object and the class which implements it. It is also possible to use kobj_init() to change the class for an object. This should be done with care as the classes must agree on the layout of the object. The device framework uses this feature to associate drivers with devices. The functions kobj_class_compile(), kobj_class_compile_static() and kobj_class_free() are used to process a class description to make method dispatching efficient. A client should not normally need to call these since a class will automatically be compiled the first time it is used. If a class is to be used before malloc(9) is initialised, then kobj_class_compile_static() should be called with the class and a pointer to a statically allocated kobj_ops structure before the class is used to initialise any objects. To define a class, first define a simple array of kobj_method_t. Each method which the class implements should be entered into the table using the macro KOBJMETHOD() which takes the name of the method (including its interface) and a pointer to a function which implements it. The table should be terminated with two zeros. The macro DEFINE_CLASS() can then be used to initialise a kobj_class_t structure. The size argument to DEFINE_CLASS() specifies how much memory should be allocated for each object. HISTORY
Some of the concepts for this interface appeared in the device framework used for the alpha port of FreeBSD 3.0 and more widely in FreeBSD 4.0. AUTHORS
This manual page was written by Doug Rabson. BSD
April 4, 2000 BSD
All times are GMT -4. The time now is 08:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy