Sponsored Content
Top Forums Shell Programming and Scripting Error while executing switch case for find and replace specific file. Help Me... Post 302678987 by Scott on Monday 30th of July 2012 06:02:44 AM
Old 07-30-2012
You need an extra ; because find needs one, and the case needs two.

Code:
  blah) find ..... {} \; ;;

I prefer to put the ;; on a new-line:
Code:
case "$inputs" in
    sapte) find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;
    ;;
    ckm1) find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {}  \;
    ;;
esac


Last edited by Scott; 07-30-2012 at 07:07 AM.. Reason: Typo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ignore case sensitive in Case Switch

In a Case switch, how to ignore case sensitive in the test: e.g. case "$field" in "TEST) action1;; *) action2;; esac How to go in action1 in case of $field = TEST , or Test , or test or .... without enumerating all possibilities... Thanks,... (1 Reply)
Discussion started by: annelisa
1 Replies

2. Shell Programming and Scripting

Help needed in Switch Case

Hi Experts team, i wish to use switch case in unix. my req is case $code in 1111) echo "1111" 1112) echo "1112" *) echo "default" esac see eventhough for particular case 1111 , it is always execute the default statement *), if i code like this. How can handle... (2 Replies)
Discussion started by: spkandy
2 Replies

3. Shell Programming and Scripting

Error: Find the pattern in the file and replace

Hi all, I have requirement where i need to find a pattern and replace it by new word. I used the below perl command echo `perl -p -i -e "s/AbCdEf/PqRsTu/g;" FileName.txt` But I am getting an error as below Can't do inplace edit Not a Owner and the file FileName.txt gets ... (9 Replies)
Discussion started by: shreekrishnagd
9 Replies

4. Shell Programming and Scripting

Find and replace a string a specific value in specific location in AIX

Hi, I have following samp.txt file in unix. samp.txt 01Roy2D3M000000 02Rad2D3M222222 . . . . 10Mik0A2M343443 Desired Output 01Roy2A3M000000 02Rad2A3M222222 . . (5 Replies)
Discussion started by: techmoris
5 Replies

5. Shell Programming and Scripting

Need an awk for a global find/replace in a file, specific column

I am new to unix and awk/sed etc... using C-Shell. Basically, I have a fixed length file that has 4 different record types on it, H, D, V, W all in column 1. I need to change all the W's in column 1 to D's. in the entire file. The W's can be anywhere in the file and must remain in the same... (3 Replies)
Discussion started by: jclanc8
3 Replies

6. UNIX for Dummies Questions & Answers

Switch and replace columns in a file

HP-UX I have a fixed length file like this 9921190625797AE2560 20091001US20091001@@NEWSITE @@ 20091013001X X 01NEW00DNA00007081 @@ SPRINGFIELD @@ ... (2 Replies)
Discussion started by: rs1969
2 Replies

7. Shell Programming and Scripting

find from file and replace with specific text

Dear All, I do not have any knowledge of scripting. I want to replace specific lines of a text file with a specific text. Like I have one file which is "original file" and one file "changes file" which has list of lines which I want to replace in original file with a specific string. I want the... (5 Replies)
Discussion started by: libras
5 Replies

8. Shell Programming and Scripting

Find and replace with 0 for characters in a specific position

Need command for position based replace: I need a command to replace with 0 for characters in the positions 11 to 20 to all the lines starts with 6 in a file. For example the file ABC.txt has: abcdefghijklmnopqrstuvwxyz 6abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz... (4 Replies)
Discussion started by: thangabalu
4 Replies

9. UNIX for Dummies Questions & Answers

Find & Replace with same case letters

I have text with upper and lower case words. I want to find something and replace it with something new. But it should match the case - Meaning - it should replace old upper cased word with NEW upper case word and lower with lower. example: this text is very simple TEXT. now I want to replace... (5 Replies)
Discussion started by: grep_me
5 Replies

10. Shell Programming and Scripting

Find and Replace from specific folders

Hello Experts, Any help is appreciated. I would like to find and replace a string in a specific file ( e.g abc.xml) only for the directories starting with "AB 1.0 DIR". I've 50 sub directories starting with "AB 1.0 DIR". And I would like find the file abc.xml in those sub-directories and... (4 Replies)
Discussion started by: builderj
4 Replies
DH_CONFIG_MODEL_UPGRADE(1p)				User Contributed Perl Documentation			       DH_CONFIG_MODEL_UPGRADE(1p)

NAME
dh_config_model_upgrade - add Config::Model based configuration merge SYNOPSIS
dh_config_model_upgrade [ debhelper options ] [ --model_name xx ] [ --model_package xx [ --model_version yy ] ] [ --edit_option "..." ] [ -p pkg ] DESCRIPTION
dh_config_model_upgrade is experimental dh_config_model_upgrade is a debhelper that will modify the package script to perform configuration merge on package upgrade. This merge is based on config-edit from Config::Model. Model information can be specified by command options or a configuration file: "debian/foo.config-model" A Model must be either : o Delivered in the package in "debian/config-model/models/" directory o Provided by another package REQUIREMENTS
For this program to work, package maintainer must ensure that: o ensure that *.postinst and *.config have a #DEBHELPER# line (if these files exist) o ensure that control file has a dependency on ${misc:Depends} OPTIONS
--model_name XX Specifies the model name (a la "Config::Model") that will be used to perform the upgrade. Without this information, "dh_config_model_upgrade" will do nothing. (shortcut "--mn") --model_for "xx yy" Specifies the package to act upon. Without this option, "dh_config_model_upgrade" will do nothing. To specify several packages, list the packages between quotes. (shortcut "--mf") --model_package XX Specifies the debian package that provide the model specified bu "-model_name". (shortcut "--mp") --model_version YY Specifies the minimal version of the package that provides the model. (shortcut "--mv") --edit_option "..." Specify a list of options or command that will be passed verbatim to config-edit during upgrade. Be sure to use quotes. -p debhelper option to specify which package(s) to act on. Usage "dh_config_model_upgrade" can be used with only command line options. For instance dh_config_model_upgrade --model_name Sshd -p openssh-server --model_package lib-config-model-openssh-perl --model_version 1.206 Alternatively, you can specify relevant information in configuration files. For instance: $ cat debian/openssh-server.config-model model_name: Sshd model_package: lib-config-model-openssh-perl model_version: 1.206 $ cat debian/openssh-client.config-model model_name: Ssh model_package: lib-config-model-openssh-perl model_version: 1.206 In this case, "dh_config_model_upgrade" will be invoked this way dh_config_model_upgrade If the model are delivered within the package, you will have to specify them in xx.install file. Here's a example based on "approx" package where the model file and the parser/writer are delivered in approx package. Debian dir contains: debian/config-model/Approx.pm debian/config-model/models/Approx.pl "debian/approx.install" contains: debian/config-model/Approx.pm usr/share/perl5/Config/Model debian/config-model/models/Approx.pl usr/share/perl5/Config/Model/models dh_config_model_upgrade is invoked as : dh_config_model_upgrade -model_name Approx debian files setup "dh_config_model_upgrade" will work if: o "control" file contains a "S{misc:Depends}" variable in "Depends" line o "rules" contains a "#DEBHELPER#" line to insert generated postinst snippet EXAMPLES
"dh_config_model_upgrade" can be called in the rules file via the dh command (no options are possible, you will have to specify "debian/*.config_model" files): %: dh --with config_model Or directly at the start of the build with build: dh_config_model_upgrade -model_name FooBar Here's an example to avoid using Augeas when upgrading build: dh_config_model_upgrade -model_name Sshd -edit_option "-backend custom" CAVEATS
Using options with a single dash (e.g. "-model_name" instead of "--model_name") will lead to ""Unknown option"" errors. ENVIRONMENT
This program will exit(0) if "DH_NO_ACT" is set or if "DEB_BUILD_OPTIONS" contains "noconfigmodel". SEE ALSO
debhelper This program is an addendum to debhelper (part of libconfig-model-perl). AUTHOR
Dominique Dumont <dod@debian.org> perl v5.14.2 2012-11-09 DH_CONFIG_MODEL_UPGRADE(1p)
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy