04-28-2008
MV files with xargs or -exec
Hi
I need to move multiple (say 10 files) from one location to another location. My selection would be like this...
ls -ltr *.arc | head ---> Need to move top 10 files with single command without iterating in loop. I know we can move files like this with find command but not sure if I can move top 10 files in any directory to another one.
Any help would be appreciated.
- Malay
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have tried both the options in small dummy scripts, but somehow i can't differentiate between the two.
find . -name H* -exec ls -l {} \;
find . -name H* | xargs ls -l
Both work the ditto way.
Any help is appreciated. (19 Replies)
Discussion started by: vibhor_agarwali
19 Replies
2. Shell Programming and Scripting
What I'm trying to do is perform a copy, well a ditto actually, on the results of a find command, but some inline string substitution needs to happen.
So if I run this code find ./ -name "*.tif" I get back these results.
.//1234567.tif
.//abcdefg.tif
Now the action from exec or xargs I... (2 Replies)
Discussion started by: myndcraft
2 Replies
3. Shell Programming and Scripting
I believe what is happening is rm is executing in the script on every directory and on failure of the first it stops although returns status 0.
find $HOME -name /directory/filename | xargs -l rm
This is the code I use but file remains. I am using sun solaris system which has way limited... (4 Replies)
Discussion started by: Ebodee
4 Replies
4. Shell Programming and Scripting
Hi,
I have many files like below in my currect dir
test1.me
test2.me
test3.me
I wanted them to rename without .me extention
I tried below
find . -name "*.me" | xargs -i mv {} `echo {} | sed 's/\.me//'`
It thorws error that
cant mv ./test1.me to ./test1.me as they are... (6 Replies)
Discussion started by: sunilmenhdiratt
6 Replies
5. Programming
I have read several docs on these on the web and looked at examples. I can't figure out the difference. In some cases you use one or the other or you combine them.
can someone help me understand this? (1 Reply)
Discussion started by: guessingo
1 Replies
6. Shell Programming and Scripting
Hi All,
i'm trying to create a tar of all the .txt files i find in my dir . I've used xargs to acheive this but i wanted to do this with exec and looks like it only archives the last file it finds . can some one advice what's wrong here :
find . -type f -name "*.txt" -print0 | xargs -0... (9 Replies)
Discussion started by: Irishboy24
9 Replies
7. Shell Programming and Scripting
Hi,
What is the difference between the following commands
find . -type f -exec grep 'abc' {} \;
and
find . -type f | xargs grep 'abc'
Appreciate your help. (2 Replies)
Discussion started by: bobbygsk
2 Replies
8. Shell Programming and Scripting
Hello Experts,
I need to copy files from one location to another using xargs.
Tried something like this (In Ubuntu & Solaris ).
mkdir -p 1234;
find /home/emd/Desktop/n007/M007/ -type f -name "A2014*" | xargs -0 cp -r {} /home/emd/Desktop/1234
But every time i run this, a weird error... (6 Replies)
Discussion started by: Saidul
6 Replies
9. Shell Programming and Scripting
Hello,
I am trying to move all the file listed by below command to /tmp/testing directory
find ./ -maxdepth 1 -type f -mtime +3
I tried using -exec and xargs - none of the combination is working?
Please, help (3 Replies)
Discussion started by: saurabh84g
3 Replies
10. Shell Programming and Scripting
Hi all,
I have a script issue I can't seem to work out.
In a directory I have several folders and I want to send just the sapdata1 to sapdata14 folders and their contents but not sapdataXX/.snapshot
the script is:
#!/bin/bash
# SETUP OPTIONS
export SRCDIR="/scratch/doug/test/sapdata*"... (5 Replies)
Discussion started by: DougyC
5 Replies
CHECKERS(6) Games Manual CHECKERS(6)
NAME
checkers - game
SYNOPSIS
/usr/games/checkers
DESCRIPTION
Checkers uses standard notation for the board:
BLACK
+-----+------+------+------+------+------+------+------+
|//// | 1 | //// | 2 | //// | 3 | //// | 4 |
|//// | | //// | | //// | | //// | |
+-----+------+------+------+------+------+------+------+
| 5 | //// | 6 | //// | 7 | //// | 8 | //// |
| | //// | | //// | | //// | | //// |
+-----+------+------+------+------+------+------+------+
|//// | 9 | //// | 10 | //// | 11 | //// | 12 |
|//// | | //// | | //// | | //// | |
+-----+------+------+------+------+------+------+------+
| 13 | //// | 14 | //// | 15 | //// | 16 | //// |
| | //// | | //// | | //// | | //// |
+-----+------+------+------+------+------+------+------+
|//// | 17 | //// | 18 | //// | 19 | //// | 20 |
|//// | | //// | | //// | | //// | |
+-----+------+------+------+------+------+------+------+
| 21 | //// | 22 | //// | 23 | //// | 24 | //// |
| | //// | | //// | | //// | | //// |
+-----+------+------+------+------+------+------+------+
|//// | 25 | //// | 26 | //// | 27 | //// | 28 |
|//// | | //// | | //// | | //// | |
+-----+------+------+------+------+------+------+------+
| 29 | //// | 30 | //// | 31 | //// | 32 | //// |
| | //// | | //// | | //// | | //// |
+-----+------+------+------+------+------+------+------+
+-----+------+------+----WHITE----+------+------+------+
Black plays first. The program normally plays white. To specify a move, name the square moved from and the square moved to. For multiple
jumps name all the squares touched.
Certain commands may be given instead of moves:
reverse Reverse roles; the program takes over your pieces.
backup Undo the last move for each player.
list Print the record of the game.
move Let the program select a move for you.
print Print a map of the present position.
CHECKERS(6)