Visit Our UNIX and Linux User Community


batching files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers batching files
# 8  
Old 03-27-2002
OK, I may also not get what you're saying, but here goes:
Are all of those files text?
And you want to create one large text file?

If so, you could do something like this:
Code:
[...]
for each in /home/rooh/ROOH*
do
cat $each >> RRO_2198
rm $each
done
[...]

You should test this first, though, before including the rm command in there...

You did mention using zip and tar, above, though. Do you want to create a tar archive?
tar cf RRO_2198.tar /home/rooh/ROOH*
zip RRO_2198.tar

Then use ftp / email / scp / etc... to move them off the box, or mv to move it around the box...

Please be more clear if this is not correct instead of simply repeating your previous posts. Maybe try asking the question using different words or analogies?
# 9  
Old 03-27-2002
Hi,

Looks like I am unable to explain my problem.
LivinFree, I used your script for testing but that doesn't help because when I do cat $each , it will copy the contents of the file,but not the complete file with its name ,and as it is.

Basically this is what i want.

Suppose I have a directory
/home/ROOH

It contains files
-rw-r--r-- 1 rooh aradm 6748 Mar 20 09:34 ROOH0039032009241204
-rw-r--r-- 1 rooh aradm 4466 Mar 20 09:34 ROOH0039032009241203
-rw-r--r-- 1 hyun aradm 4466 Mar 20 09:31
ROOH0032567890098879

and so on.......

what I want is basically a file which should contain these files as they are.

Suppose a file ROOH01
it should contain the files like

-rw-r--r-- 1 rooh aradm 6748 Mar 20 09:34 ROOH0039032009241204
-rw-r--r-- 1 rooh aradm 4466 Mar 20 09:34 ROOH0039032009241203
-rw-r--r-- 1 hyun aradm 4466 Mar 20 09:31
ROOH0032567890098879

So basically this is what I want.

Hope I am clear this time.

Thanx
Rooh
# 10  
Old 03-28-2002
i really dont think what your trying to do can be done the way you want it to be done.

if there are other files in the directory along with the wanted "files", i would suggest you try creating a new directory and then moving only those wanted files into that directory. then backup the directory itself by using, (tar, cpio, dd). see if that helps at all
# 11  
Old 03-28-2002
Hi ,
Thanx for ur responce.
Your idea seems to be great , can I ask for one more favour.

Can you tell me how I can create a backup.

It sounds great that I have a new_irectory and first move all my wanted files into the new directory.

But can you tell me how I can create the backup of this.

Your help will be highly appreciated.

Thanx alot of the good suggestion .

Rooh
# 12  
Old 03-28-2002
after you have created a new directory and moved all the wanted files in there, then:

you should use tar cvf (output file) (absolute path of the new directory to backup)

output file = name of the file you want the directory to be backed up in to (make up any name)

absolute path of the new directory to backup = the complete path to where the newly created directory is located at

say I want to back up a directory named new_directory into a one file called directory_backup

i do this

tar -cvf directory_backup new_directory
(note: you have to specify the absolute path of the directory you want to backup)

later, if you wanna extract the files or any file from the backup tar achieve you just created, you simply type:

tar -xvf (directory_backup) (new_directory/whatever files you want to retrieve or extract)

again, directory_backup here means the file you backed up the directory into
new_directory means the path to the directory you want to backup




Let me know if your satisfied with the results

Last edited by TRUEST; 03-28-2002 at 04:16 PM..
# 13  
Old 03-28-2002
That seems to work great . Thanx alot for sharing your expertise.

Can i trouble you any further.
One more question ?

Is it possible to do something like this with cpio.
If yes How ????

Thanks.
Rooh
# 14  
Old 03-28-2002
if you want to use cpio, this is what you do:

you cd into the newly created directory containing only those files you want.

then you type this:

ls | cpio -oO (name of backupfile)

say I want to backup those files I want into a file called smart.cpio, this is what I do

ls | cpio -oO smart.cpio

if i want to extract all files from smart.cpio, I will type:

cpio -itI smart.cpio



that should help you out
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #862
Difficulty: Medium
Vue uses an HTML-based template syntax that allows binding the rendered DOM to the underlying Vue instance's data.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies

2. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

3. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

4. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

5. Shell Programming and Scripting

newbie needs help batching awk, tabitha

Hi guys, I need a little help learning to batch an awk script. All the examples I found on line are too complicated for me. Here's the awk command that I want to run on lots of files. awk 'NR==FNR{a=$0;next$3 in a{print $0 a " " a}' inputfile_A_1.out inputfile_B_1.out > outputfile1.txt ... (11 Replies)
Discussion started by: atjurhs
11 Replies

6. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

7. UNIX for Dummies Questions & Answers

write a program in c in unix that display the files(includ sub-direc and files within) in a sorted

the sorting is based on name of file, file size modification time stamps o f file it should dislay the output in the following format "." and ".." enteries should be ignored please give some idea how to do it (1 Reply)
Discussion started by: pappu kumar jha
1 Replies

8. Shell Programming and Scripting

How to retrieve all the linked script files/ctl files/sql files?

Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux. Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies

9. Shell Programming and Scripting

Grep causing long delay (batching) whilst piping

Hi all. I have a problem at work which I have managed to break down into a simple test scenario: I have written a monitoring script that outputs every second the status of various processes, but for now, lets just print the date input.sh: while true do date sleep 1 done This... (9 Replies)
Discussion started by: spudtheimpaler
9 Replies

10. Shell Programming and Scripting

batching files together

I'm looking after part of an application which batches up files concatanates them together and then moves the concatanated files to another directory. The problem I have is that the box runs Windows 2003 and UNIX shell emulation is provided by MKS Toolkit, when 10,000 or more files arive in the... (1 Reply)
Discussion started by: pookie
1 Replies

Featured Tech Videos