LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2006, 10:43 PM   #16
DarthPooh
LQ Newbie
 
Registered: Mar 2006
Posts: 19

Rep: Reputation: 0

Quote:
Originally Posted by mikejac69
#!/bin/bash
#changing file extensions
for i in *.src
do
x=`echo "$i"|sed -e 's/.src/.c/'`
cp "$i" /home/mike/tester/"$x"
done

oops, missed the dots!!

I also see some others have already posted their scripts whilst I was writing mine
How can I make this script more generic? If i called the script 'ren', I would like 'ren' to be able to do all the following:

ren *.pl *.cgi
ren dan_* Daniel-*
ren *1980* *2006*
ren Jun.*.txt JUNE-*.doc
 
Old 06-01-2006, 11:16 AM   #17
chenglim
LQ Newbie
 
Registered: Jan 2005
Posts: 18

Rep: Reputation: 0
in sch day.. we learn variable.
=)

$original = "src"
$change = "c"

s/$original/$change/

Hope it helps
 
Old 06-01-2006, 11:59 AM   #18
DarthPooh
LQ Newbie
 
Registered: Mar 2006
Posts: 19

Rep: Reputation: 0
Quote:
Originally Posted by chenglim
in sch day.. we learn variable.
=)

$original = "src"
$change = "c"

s/$original/$change/

Hope it helps
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing ownership and group of multiple files.. utanja Debian 3 02-21-2005 07:10 PM
symlink multiple files to new directory with new extension jmanjohn61 Linux - General 1 01-06-2005 01:55 PM
What to do about these files with .new extension? Slovak Slackware 1 11-23-2004 05:50 PM
How program to read files with extension .dat y .cfg files COMTRADE in fedora 1? ivonne Linux - Software 0 11-22-2004 12:42 PM
changing extension of multiple files shaggystyle Linux - General 5 01-29-2004 01:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration