Sponsored Content
Top Forums Shell Programming and Scripting Copy files based on specific word in a file name & its extension and putting it in required location Post 302984175 by RudiC on Friday 21st of October 2016 03:20:39 PM
Old 10-21-2016
Based on a few assumptions as answers to above questions, try
Code:
for i in MUM/*/*
  do    EXT=${i#*.}
        FP=${i%.*}
        [ $EXT == "txt" ] && { CV="conv=ebcdic"; EXT="dat"; } || CV=""
        echo dd if=$i of=${FP/MUM/TUM}.$EXT $CV
  done
dd if=MUM/HYR/ttt_hyr_20162010.db of=TUM/HYR/ttt_hyr_20162010.db
dd if=MUM/HYR/ttt_hyr_20162010.md of=TUM/HYR/ttt_hyr_20162010.md
dd if=MUM/HYR/ttt_hyr_20162010.txt of=TUM/HYR/ttt_hyr_20162010.dat conv=ebcdic
dd if=MUM/MAR/ttt_mar_20162010.db of=TUM/MAR/ttt_mar_20162010.db
dd if=MUM/MAR/ttt_mar_20162010.md of=TUM/MAR/ttt_mar_20162010.md
dd if=MUM/MAR/ttt_mar_20162010.txt of=TUM/MAR/ttt_mar_20162010.dat conv=ebcdic
dd if=MUM/PAR/ttt_par_20162010.db of=TUM/PAR/ttt_par_20162010.db
dd if=MUM/PAR/ttt_par_20162010.md of=TUM/PAR/ttt_par_20162010.md
dd if=MUM/PAR/ttt_par_20162010.txt of=TUM/PAR/ttt_par_20162010.dat conv=ebcdic
dd if=MUM/SAR/ttt_sar_20162010.db of=TUM/SAR/ttt_sar_20162010.db
dd if=MUM/SAR/ttt_sar_20162010.md of=TUM/SAR/ttt_sar_20162010.md
dd if=MUM/SAR/ttt_sar_20162010.txt of=TUM/SAR/ttt_sar_20162010.dat conv=ebcdic

You may want to play with dd's status=xxx operand to influence the amount of info printed to stderr...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

2. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

3. UNIX for Dummies Questions & Answers

how to copy files and record original file location?

:EDIT: I think my post name should have been labeled: how to copy files and record original file location. not "retain". Hello, this is my first post! I searched the forums a lot before posting, but was unable to answer my question. Here's my problem: There are several hundred text files... (4 Replies)
Discussion started by: willie8605
4 Replies

4. Shell Programming and Scripting

Using sed to replace a word at specific location

I'm try to change a the prohibit to aix for the lines starting with ssh and emagent and rest should be the same. Can anyone please suggest me how to do that using a shell script or sed passwd account required /usr/lib/security/pam_prohibit passwd session required ... (13 Replies)
Discussion started by: pjeedu2247
13 Replies

5. Shell Programming and Scripting

How to find a word and move it a specific location in xml file using perl?

Hi friends, I have one XML file having below structure :- INput XML file :- <?xml version="1.0" encoding="UTF-8"?> <START> <A=value1> <attr name1="a1"> </A> <B=value2> <attr name2="b1"> <attr name3="c1"> </B> </START> output xml file should be === (3 Replies)
Discussion started by: harpal singh
3 Replies

6. Shell Programming and Scripting

Deleting lines in a fixed length file where there is a word at specific location

I have a big file having 100 K lines. I have to read each line and see at 356 character position whethere there is a word "W" in it. If it is their then don't delete the line otherwise delete it. There are two lines as one Header and one trailer which should remain same. Can somebody... (5 Replies)
Discussion started by: mohit kanoongo
5 Replies

7. Shell Programming and Scripting

How to copy files from one location to another based on a priority?

Hi Gurus, I am a newbie to shell scripting and I am facing a problem right now.I have to automate the copy of files based on a priority.The scenario is as below: 1) There will be files from Mon-Fri with Mon file being named as abc_def_01_YYYYMMDD and Tue file being abc_def_02_YYYYMMDD and so... (4 Replies)
Discussion started by: vikramgk9
4 Replies

8. UNIX for Dummies Questions & Answers

Display the .csv extension files based on .done extension fine

Hi All, I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing. 1.I need to display the .done files from the directory. 2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory ... (2 Replies)
Discussion started by: girija.g6
2 Replies

9. Shell Programming and Scripting

Find and Copy file of specific location

Dear All, I need to transfer all files present in one location to another but those files should be of specific extension like. Find and copy all files of extension .xls, .pdf, .txt from location usr/tmp to location /per/Treat (6 Replies)
Discussion started by: yadavricky
6 Replies

10. Shell Programming and Scripting

Delete all files of a particular name & extension except one file.

I wish to delete all files that starts with "body<any number of digits>.xml" except body65.xml on Linux 7 bash shell So, from the below files body64.xml body.sh body65.xml body655.xml body565.xml body66.xml hello65.xml My command should delete all files except the below. body.sh... (2 Replies)
Discussion started by: mohtashims
2 Replies
PAR::Filter(3)						User Contributed Perl Documentation					    PAR::Filter(3)

NAME
PAR::Filter - Input filter for PAR SYNOPSIS
$code = 'use strict; print "Hello, World! ";'; $ref = PAR::Filter->new('PodStrip', 'Bleach')->apply($code); print $code; # pod-stripped and obfuscated code print $$ref; # same thing $ref = PAR::Filter->new('PodStrip', 'Bleach')->apply('file.pl'); print $$ref; # same thing, applied to file.pl DESCRIPTION
Starting with PAR 0.76, "pp -f" takes a filter name, like "Bleach", and invokes this module to transform the programs with PAR::Filter::Bleach. Similarily, "pp -F Bleach" applies the Bleach filter to all included modules. It is possible to pass in multiple such filters, which are applied in turn. The output of each such filter is expected be semantically equivalent to the input, although possibly obfuscated. The default list of filters include: o PAR::Filter::Bleach The archetypical obfuscating filter. o PAR::Filter::Obfuscate Use B::Deobfuscate to strip away indents and comments, as well as mangling variable names. o PAR::Filter::PatchContent Fix PAR-incompatible modules, applied to modules by default. o PAR::Filter::PodStrip Strip away POD sections, applied to modules by default. o PAR::Filter::Bytecode Use B::Bytecode to strip away indents and comments. This filter is deprecated! For source hiding, have a look at PAR::Filter::Crypto instead and make sure to read about its caveats. AUTHORS
Audrey Tang <cpan@audreyt.org> COPYRIGHT
Copyright 2003-2009 by Audrey Tang <cpan@audreyt.org>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.12.5 2011-03-22 PAR::Filter(3)
All times are GMT -4. The time now is 08:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy