Sponsored Content
Full Discussion: Script to change file name
Top Forums UNIX for Dummies Questions & Answers Script to change file name Post 302654895 by jawsnnn on Tuesday 12th of June 2012 11:20:49 AM
Old 06-12-2012
My bad. This one inserts the "_failed" command before the extension.

Code:
#!/bin/ksh
if [ -e $1 ]; then
  ofile=`echo $1 | sed 's/\(.*\)\.\(.*\)/\1_failed.\2/g'`
  cp "$1" "${ofile}"
fi

Hope this helps.
This User Gave Thanks to jawsnnn For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

script to change value in file

Hi, I have a parameter file and it contains following items $ cat TransactionParams From_Date_Parm=2005-02-25 To_Date_Parm=2005-05-25 Extract_Root_Parm=/detld1/etl/ascential/Ascential/DataStage/Projects/CTI_London/IAM Extract_Type_Parm=Transaction EDW_Database_Parm=hdw_erks... (1 Reply)
Discussion started by: gopskrish
1 Replies

2. Shell Programming and Scripting

script to ftp file (ip change)

Hi All, If I want to ftp files from machine to local pc. But the ip must change everytime :( (due to VPN), can I write a script to easiler (no need to update ip in script)? user_name=aaa password=bbb cat ip.txt # # FTP the files # ftp -d -in 199.200.204.109 <<EOF user $user_name... (2 Replies)
Discussion started by: happyv
2 Replies

3. Shell Programming and Scripting

Need help script to change the log file?

Hi I have log like this : And i want the log become like this : can somebody help me?? (5 Replies)
Discussion started by: justbow
5 Replies

4. Shell Programming and Scripting

Help with shell script for know when a file change it

Hi, IŽd like to know how to program a shell script for know when a file changes and based on that make another tasks all this in real time.. Thanks (2 Replies)
Discussion started by: mrios7
2 Replies

5. Shell Programming and Scripting

change file contents using script

Hi, Requirement:- Need to change pfile,so while executing script,it has to go to pfile location(ORACLE_HOME/dbs) and open init<SID>.ora file and change value db_name=<>. If db_name=abcd,script will change the db_name=1234 likr that.. Please help to code this (1 Reply)
Discussion started by: Sanal
1 Replies

6. Shell Programming and Scripting

Change XML file structure script

Hi to all, Maybe someone could help me. I want to transform the structure of a xml file. I have this input.xml: <?xml version="1.0" encoding="utf-8"?> <votings> <file name="Reference 19762"> <case id="No. 3 Div. 870"> <j v="1">Peter</j> <j v="1">Ely</j> <j... (10 Replies)
Discussion started by: cgkmal
10 Replies

7. Shell Programming and Scripting

Change value in a file using perl or shell script

hi, I have a local.conf file which has the first line TOPDIR = "/home/mvdev/workspace/boxer". I want to replace the value to "/home/common/workspace/mirror". I tried the following perl command that is perl -p -i -e 's/Path/path1/g' myfile.txt then sed... (7 Replies)
Discussion started by: amvarma77
7 Replies

8. Shell Programming and Scripting

Need script to change a line in file....

Hello all, I have a line of code in a file that I need to change in the /etc/sysconfig/kdump file presently the line reads: KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off" what I need to do is put a comment out the 1st line and repeat it, and... (5 Replies)
Discussion started by: gartie
5 Replies

9. Shell Programming and Scripting

Script to change name of a file with date

I have a file that contains todays date(for ex- test_08/30/2013) Now I want a script which will run and change the name of the file and put yesterday's date (for ex- test_08/29/2013) Please help. ---------- Post updated at 04:40 AM ---------- Previous update was at 04:31 AM ---------- I... (2 Replies)
Discussion started by: sv0081493
2 Replies

10. Shell Programming and Scripting

Script to change file names

I have a landing directory on my unix (solaris) server, that receives the following files: MLH4301I AAOT-hhslog.610.20150805.txt MLH4301I AAOT-hhslog.611.20150805.txt MLH4301I AAOT-hhslog.612.20150805.txt MLH4301I AAOT-hhslog.613.20150805.txt and I need to add to this files the number 10000... (6 Replies)
Discussion started by: fretagi
6 Replies
mmk_m2(1)						       Scotch user's manual							 mmk_m2(1)

NAME
mmk_m2, mmk_m3 - create source meshes SYNOPSIS
mmk_m2 [options] [-gcfile] dimX dimY [ofile] mmk_m3 [options] [-gcfile] dimX dimY dimZ [ofile] DESCRIPTION
The mmk_* programs create source mesh files for some common, regular topologies. mmk_m2 creates a 2D regular mesh of dimX times dimY elements and (dimX+1) times (dimY+1) nodes, such that element (i,j) is connected to nodes (i,j), (i,j+1), (i+1,j) and (i+1,j+1). mmk_m3 creates a 3D regular mesh of dimX times dimY times dimZ elements and (dimX+1) times (dimY+1) times (dimZ+1) nodes, such that element (i,j,k) is connected to nodes (i,j,k), (i,j,k+1), (i,j+1,k), (i,j+1,k+1), (i+1,j,k), (i+1,j,k+1), (i+1,j+1,k) and (i+1,j+1,k+1). OPTIONS
-gcfile Output graph vertex coordinates (that is, geometry data to be used by gout(1)) in file cfile. -h Display some help. -V Display program version and copyright. EXAMPLE
Create a mesh of 5x7 elements, along with its geometry: $ mmk_m2 5 7 -g/tmp/m5x7.xyz /tmp/m5x7.msh SEE ALSO
mord(1), mtst(1), gmk_msh(1). Scotch user's manual. AUTHOR
Francois Pellegrini <francois.pellegrini@labri.fr> February 14, 2011 mmk_m2(1)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy