Sponsored Content
Top Forums Shell Programming and Scripting copy similar files only both at different locations using script. Post 302146887 by fed.linuxgossip on Thursday 22nd of November 2007 11:51:51 PM
Old 11-23-2007
copy similar files only both at different locations using script.

Hello,

Here is the situation..............


[root@server 123]# pwd
/opt/123

[root@server 123]# cat index.txt
abc-monitor/homedir/public_html/index.php
abc-monitor/homedir/public_html/test/index.php
abc-monitor/homedir/public_html/test1/index.php


[root@server 123]# cp index.txt index.home




[root@server123]# cat /root/x
#!/bin/bash
user="monitor"

replace "cpmove-$user/homedir" "/$user" -- index.home

[root@server 123]# chmod +x /root/x ; /root/x

[root@server 123]# cat index.home
/home/monitor/public_html/index.php
/home/monitor/public_html/test/index.php
/home/monitor/public_html/test1/index.php




Now I want such a script that all files in `cat index.txt` will move to `cat index.home` and replace them.

Example...

mv -f abc-monitor/homedir/public_html/index.php /home/monitor/public_html/index.php
mv -f abc-monitor/homedir/public_html/test/index.php /home/monitor/public_html/test/index.php
mv -f abc-monitor/homedir/public_html/test1/index.php /home/monitor/public_html/test1/index.php







Please advise.


Thanks

Last edited by fed.linuxgossip; 11-23-2007 at 01:18 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

2. Shell Programming and Scripting

Untar files from different locations

Hi all, My tar file exists in directory: /usr/users/rovolis/test1/archive.tar Now from directory: /usr/users/rovolis/ i run the following command tar xvzf /usr/users/rovolis/test1/archive.tar The problem is that the extraction of files is not done Any idea why? Thank you (1 Reply)
Discussion started by: chriss_58
1 Replies

3. Shell Programming and Scripting

Need script to rename the files in different locations

Hi everybody, I need a script for below issue: I have totally 15 different locations like */COUNTRY/in. Only COUNTRy is the variable which changes for 15 countries. For each location(one per country), there will be four files like abc_def_ddmmyyyy.txt, where ddmmyyyy is the old date. ... (1 Reply)
Discussion started by: rjanardhan83
1 Replies

4. UNIX for Dummies Questions & Answers

running script in multiple locations

Hey guys I have written a bash script that compares two directories and displays the files that are different in the directories. Now my problem is the script only runs in my home directory. What do I have to do so it will run in other directories. Thanks if anyone can help. Duplicate post.... (0 Replies)
Discussion started by: Joey12
0 Replies

5. UNIX for Dummies Questions & Answers

Copying files from unix servers to other locations e.g. C directory

Hi, I am just wondering is it possible to move or copy a file from a UNIX server to a different location e.g. the C drive on a computer? I have used the cp command to move files to different locations on unix servers but it would be handy to move a file to my C drive. I am currently... (3 Replies)
Discussion started by: crunchie
3 Replies

6. Shell Programming and Scripting

Script to move files with similar names to folder

I have in directory /media/AUDIO/WAVE many .mp3 files with names like: my filename_01of02.mp3 my filename_02of02.mp3 Your File_01of06.mp3 Your File_02of06.mp3 etc.... In the same directory, /media/AUDIO/WAVE, I have many folders with names like 9780743579490 9780743579491 etc.. Inside... (7 Replies)
Discussion started by: glev2005
7 Replies

7. Shell Programming and Scripting

Computing the ratio of similar columns in the two files using awk script

Thanks Bartus11 for your help in the following code to compare the two files "t1" and "t2". awk 'NR==FNR{a=1;next}$2 in a{print $2}' t1 t2 First can anyone explain that what is the purpose of assigning a =1? Second, the current script is printing out the matched columns between the... (4 Replies)
Discussion started by: coder83
4 Replies

8. Shell Programming and Scripting

awk script to perform an action similar to vlookup between two csv files in UNIX

Hi, I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files. Here are the contents of the two files: File 1: Date,ParentID,Number,Area,Volume,Dimensions 2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies

9. Shell Programming and Scripting

Shell script to delete empty files from specific locations

Hi, I need help in regard to developing a shell script to delete empty files from multiple specific locations. The directory paths will be stored in a text file. So the requirement is to read the text file for one specific path and then remove empty files from that particular path. Looping through... (4 Replies)
Discussion started by: Khan28
4 Replies

10. Shell Programming and Scripting

Run a script before and after reboot automatically and send output to two locations.

Hello Team . I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are 1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ? 2. The same... (2 Replies)
Discussion started by: Varja
2 Replies
MSGFMT_SET_PATTERN(3)							 1						     MSGFMT_SET_PATTERN(3)

MessageFormatter::setPattern - Set the pattern used by the formatter

	Object oriented style

SYNOPSIS
public bool MessageFormatter::setPattern (string $pattern) DESCRIPTION
Procedural style bool msgfmt_set_pattern (MessageFormatter $fmt, string $pattern) Set the pattern used by the formatter PARAMETERS
o $fmt - The message formatter o $pattern - The pattern string to use in this message formatter. The pattern uses an 'apostrophe-friendly' syntax; it is run through umsg_autoQuoteApostrophe before being interpreted. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 msgfmt_set_pattern(3) example <?php $fmt = msgfmt_create( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatting result: " . msgfmt_format( $fmt, array(123, 456) ) . " "; msgfmt_set_pattern( $fmt, "{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatted number: " . msgfmt_format( $fmt, array(123, 456) ) . " "; ?> Example #2 OO example <?php $fmt = new MessageFormatter( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . $fmt->getPattern() . "' "; echo "Formatting result: " . $fmt->format(array(123, 456)) . " "; $fmt->setPattern("{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . $fmt->getPattern() . "' "; echo "Formatted number: " . $fmt->format(array(123, 456)) . " "; ?> The above example will output: Default pattern: '{0,number} monkeys on {1,number} trees' Formatting result: 123 monkeys on 456 trees New pattern: '{0,number} trees hosting {1,number} monkeys' Formatted number: 123 trees hosting 456 monkeys SEE ALSO
msgfmt_create(3), msgfmt_get_pattern(3). PHP Documentation Group MSGFMT_SET_PATTERN(3)
All times are GMT -4. The time now is 04:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy