Sponsored Content
Operating Systems Linux Debian Changing file extension names Post 303000637 by anaigini45 on Monday 17th of July 2017 02:09:17 AM
Old 07-17-2017
Changing file extension names

Hi I have a list of files :
Code:
root@L28mustang:/var/log/exim4/2017/Jul2017_Blast_BC07# ls -lrt | grep mainlog
-rw-r----- 1 Debian-exim adm  3636932 Jul  8 06:25 mainlog.3.gz
-rw-r----- 1 Debian-exim adm   919512 Jul  9 06:27 mainlog.2.gz
-rw-r----- 1 Debian-exim adm  7655054 Jul 10 06:25 mainlog.1
-rw-r----- 1 Debian-exim adm  2799218 Jul 10 15:40 mainlog

I need to change the extension names for all the files above to .filtered.
I know how to do it for the .gz files like this :

Code:
for i in mainlog*
	do
	   exigrep L28stream1 "$i" | egrep -v "jiun.shyong.hor@ericsson.com|chander.c.shekher@ericsson.com|nagios|L28eagle" > "${i/%.gz/.filtered}"
done

How do I change both the mainlog files with the .gz extension and without the .gz extension in one command?

Last edited by rbatte1; 07-17-2017 at 12:33 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

changing file names to lowercase

hey guys having some trouble figuring this out. my program is supposed to take a name of a directory as a command line argument and change the filenames inside that directory to lowercase. what i dont get is how you access that directory and go thru all the files and change the filenames... (1 Reply)
Discussion started by: 30177005
1 Replies

2. UNIX for Dummies Questions & Answers

Changing the extension of the file

I have a list of files in a particular folder Example: File name - sample.F1.test I want to change the extension of the above file to .csv The final file should be renamed as sample.csv (4 Replies)
Discussion started by: mazhar803
4 Replies

3. UNIX for Dummies Questions & Answers

changing file extension

Hello, everyone! :] I'm having an issue with my camera/uploading to Photobucket. When my camera transfers it's photos to my hard drive, it transfers them as .JPG. Unfortunately, when I go to upload to my Photobucket account, it only accepts .jpg & .jpeg files. Every time I want to upload, I... (6 Replies)
Discussion started by: spidydude
6 Replies

4. UNIX for Dummies Questions & Answers

Changing file extension

Hello all, I need to change file extension for all .doc files to .txt file in multiple folders. I know the way to rename them by going to each folder and doing that, but I need something which I can run from home directory so that It does the renaming in all the nested directories. Thanks. (4 Replies)
Discussion started by: jaysean
4 Replies

5. Shell Programming and Scripting

Changing file names

I have lot of files whose names are something like the following. I want to change the name of all the files from 'npt02' to 'n02'. npt02-z30-sr65-rgdt0p50-dc0p01-16x12drw.tpf npt02-z30-sr65-rgdt0p50-dc0p01-8x6drw.back npt02-z30-sr65-rgdt0p50-dc0p01-8x6drw-bst-mis.xy... (5 Replies)
Discussion started by: kristinu
5 Replies

6. Shell Programming and Scripting

[SOLVED] Changing file names

I have written a csh script that changes the name of file from src to dst. I am getting the error below: TESTAmvfiles DONE TESTAmvfiles set: Variable name must begin with a letter. The csh script is: #!/bin/csh #... (0 Replies)
Discussion started by: kristinu
0 Replies

7. Shell Programming and Scripting

Changing file extension in csh alias

I want to type only the filename of a gcc source that has ".syn" as an extension and copy it, changing the extension to ".c" so it can be compiled. I do it as follows: if (-e $1.syn) then /bin/cp $1.syn $1.c endif This works fine, but if I want to repeat the compilation by... (1 Reply)
Discussion started by: ygmwayne
1 Replies

8. Shell Programming and Scripting

Changing file names

I have file names as shown and want to change the name to have only the first four numbers. /home/chrisd/Desktop/nips/nips_2013/5212-learning-feature-selection-dependencies-in-multi-task-learning.pdf /home/chrisd/Desktop/nips/nips_2013/5213-parametric-task-learning.pdf... (3 Replies)
Discussion started by: kristinu
3 Replies

9. Shell Programming and Scripting

Changing file names

I have a series of files as follows file-1.pdf file-2.pdf file-3.pdf file-4.pdf file-5.pdf file-6.pdf file-7.pdf I want to have the file names with odd numbers starting from an initial number, for example 2000. The result would be the following: file-2001.pdf file-2003.pdf... (9 Replies)
Discussion started by: kristinu
9 Replies

10. Shell Programming and Scripting

Changing file names

sac_pzs_iv_epoz_hhe__2013.074.14.40.46.0000_2599.365.23.59.59.99999 sac_pzs_iv_epoz_hhn__2013.074.14.40.46.0000_2599.365.23.59.59.99999 sac_pzs_iv_epoz_hhz__2013.074.14.40.46.0000_2599.365.23.59.59.99999 sac_pzs_iv_haga_hhe__2006.111.00.00.00.0000_2599.365.23.59.59.99999... (3 Replies)
Discussion started by: kristinu
3 Replies
EXIQGREP(8)						      System Manager's Manual						       EXIQGREP(8)

NAME
exiqgrep - Search in the exim queue SYNOPSIS
exiqgrep [-a] [-c] DESCRIPTION
The exiqgrep utility is a Perl script which offers possibilities to grep in the exim queue output. Unlike exiqsumm, it invokes exim -bpu itself and does not need to be invoked in a pipe. OPTIONS
-h Print help -f <regexp> Match sender address (field is "< >" wrapped) -r <regexp> Match recipient address -s <regexp> Match against the site field from long output -y <seconds> Message younger than -o <seconds> Message older than -z Frozen messages only (exclude non-frozen) -x Non-frozen messages only (exclude frozen) -c Display match count -l Long Format [Default] -i Message IDs only -b Brief Format -R Reverse order BUGS
This manual page needs a major re-work. If somebody knows better groff than us and has more experience in writing manual pages, any patches would be greatly appreciated. SEE ALSO
exim(8), /usr/share/doc/exim4-base/ AUTHOR
This manual page was stitched together from the source code by Marc Haber <mh+debian-packages@zugschlus.de>, using the exiqsumm man page by Andreas Metzler <ametzler at downhill.at.eu.org>, for the Debian GNU/Linux system (but may be used by others). March 26, 2003 EXIQGREP(8)
All times are GMT -4. The time now is 04:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy