Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Adding an extension to a group of filenames Post 49743 by pepintheshort on Friday 9th of April 2004 10:37:58 AM
Old 04-09-2004
Adding an extension to a group of filenames

Hi -
I'm stuck. I have a group of text files created using the split command. My files have the names "projectaa", "projectab", "projectac", etc. What I want to do is add the extension ".txt" to each file. I think I've got part of a sed command together, but I'm stuck on my regex - I keep getting an error "Illegal variable name".

Here's the regex I created:

ls -d * | sed "s/^project[a-z][a-z]$/mv '&' \.txt/" | sh -v

Can anybody help me fix this? Or, offer an alternative way of renaming the files? I don't want to use the mv command by itself because each time I use split on a new text file, I won't know how many new files will be created.

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading filenames with extension .xml

Hi, I want to write a script to read all the filenames with extension .xml in a directory and pass the name of the file, one by one, to another function. Please help me out. Regards. Saurabh (3 Replies)
Discussion started by: bhalotias
3 Replies

2. UNIX for Dummies Questions & Answers

removing the extension from all filenames in a folder

Hi there, I'm pretty new to UNIX and have tried trawling through this forum to find an answer to what I want to try to do, which I'm sure is very simple but I don't know how to do it. What I have a a folder that contains multiple files that I have copied from Windows and I want to remove the... (5 Replies)
Discussion started by: johnmcclintock
5 Replies

3. Shell Programming and Scripting

Help with adding to tar filenames

Hi there, i have been working on a backup script and have it just about working, the only problem im left with is that my filenames for my backups are all the same are replacing one another when backing up. currently i have BACKUP_FILE=backup_$(date +%d%m%y).tgz but would like something like... (2 Replies)
Discussion started by: Swinton
2 Replies

4. Shell Programming and Scripting

How to split a file with adding sequence number and extension.

I have a file name -HRCFTSIN05PLA1602100430444444 my requirement is to split the file in 10000 count each file and to add sequence number.rch at the end of each file. output should be in this format HRCFTSIN05PLA160210043044444401.rch HRCFTSIN05PLA160210043044444402.rch... (4 Replies)
Discussion started by: abhigrkist
4 Replies

5. Shell Programming and Scripting

Adding lines to files based on file extension

I have posted this before but did not get many replies, so here it goes again. I have several files name like this If the file extension is 1a, I woould like to add at the beggining of the file the following sequence If the file extension is 1b, thn the entry that should be added is the next... (2 Replies)
Discussion started by: Xterra
2 Replies

6. Shell Programming and Scripting

Adding the data before file extension

HI , I have a file with multiple lines like below, I need to check on column starting with #prototype if it has the .Number.txt extension do nothing else add 1.txt extension. Source data Jdbc_app_data :- sample data #prototype= sample data from test.1.txt application_id=122135... (4 Replies)
Discussion started by: gaur.deepti
4 Replies

7. Shell Programming and Scripting

Adding number before file extension

Hi , I have a file which has a line starts with $segment_name and has the below data source data $Segment_Name = 123.ABC.123.01.txt $Segment_Name = 123.ABC.ABC.txt $Segment_Name = 123.ABC.12A3.txtMy target data should be $Segment_Name = 123.ABC.123.01.txt $Segment_Name =... (2 Replies)
Discussion started by: shruthidwh
2 Replies

8. AIX

Adding a Volume Group to an HACMP Resource Group?

Hi, I have a 2 node Cluster. Which is working in active/passive mode (i.e Node#1 is running and when it goes down the Node#2 takes over) Now there's this requirement that we need a mount point say /test that should be available in active node #1 and when node #1 goes down and node#2 takes... (6 Replies)
Discussion started by: aixromeo
6 Replies

9. Shell Programming and Scripting

change filenames but not extension

I have a filename with a bunch of periods that I want to replace with underscores, but I don't want to change the extension. Ex: I want file.test1.f-1.fig.eps to be file_test1_f-1_fig.eps Using awk, the following line will replace ALL periods with underscores, but I want to leave the... (2 Replies)
Discussion started by: erinbot
2 Replies

10. Shell Programming and Scripting

How to remove filenames having the same extension.?

hi, i have a directory which contains some files and a subdirectory. i am writing only the files names to a file using the below code. ls -ltr | grep "^-" | awk '{print $NF}' > /home/file_list$$ cat /home/file_list$$ s1_abc.txt s2_def.xls s3_def.xls as you can see there is one .txt... (7 Replies)
Discussion started by: Little
7 Replies
passwd_export(1m)														 passwd_export(1m)

NAME
passwd_export - Creates local password and group files SYNOPSIS
passwd_export [-d dir_name] [-m max_entries] [-h[elp]] [-n] [-s] [-v] [-x] OPTIONS
The name of the directory to store the password, group, and organization files created by passwd_export. If you do not enter a directory name, the files are stored in the /etc directory. Display help information. Ignore passwd_override and group_override file entries. Without this option, passwd_export applies the override entries from both files to the local password and group files it creates. The max- imum number of entries that can be stored in the local files. Sort the local password and group file entries by UNIX number. If you do not specify this option, the entries are in order as they are retrieved from the registry. Run in verbose mode. Do not create entries for users with OMIT as their encrypted password in the passwd_override and group_override files. See the passwd_override and group_override reference pages for further details about omitting users. DESCRIPTION
The dceshared/bin/passwd_export command creates local password and group files from registry data. These files are used when the network registry is unavailable and by programs that use the original UNIX passwd and group interfaces instead of the DCE interfaces. Use passwd_export to keep these local files consistent with the registry database. When passwd_export runs, it makes backup copies of the current password and group files, if they exist. The files are named, respectively, passwd.bak and group.bak. By default, the backups are stored and the new files created in the /etc directory. You can override the default by supplying a directory name with the -d option. Running passwd_export The passwd_export command is commonly run with an entry in /usr/lib/crontab. For example, to update the files every hour, the entry is 0 * * * * dceshared/bin/passwd_export In large network environments, it is a good idea to stagger the times passwd_export is run. RELATED INFORMATION
Commands: rgy_edit(1m) Files: group(5), passwd(5), passwd_override(5), group_override(5) passwd_export(1m)
All times are GMT -4. The time now is 07:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy