Sponsored Content
Top Forums Shell Programming and Scripting how to find first files in a directory and combine them as a single file? Post 302663447 by vel4ever on Thursday 28th of June 2012 06:27:28 AM
Old 06-28-2012
how to find first files in a directory and combine them as a single file?

i have below list of files in a directory.

Code:
/root/admin/files/file1.txt
/root/admin/files/file2.txt
/root/admin/files/file3.txt
/root/admin/files/pattern.txt
/root/admin/files/server.txt

i need combine the above text files in the below sequence,

file1.txt, pattern.txt,server.txt => group1.txt
file2.txt => group2.txt
file3.txt => group3.txt

i need help find the first files (file1.txt, pattern.txt,server.txt) in a shell script running in a another directory

Code:
/root/admin/script/grouping.sh

 

9 More Discussions You Might Find Interesting

1. Solaris

Find files older than x days and create a consolidated single tar file.

Hello, I need help in finding files older than x days and creating a single consolidated tar file combining them. Can anyone please provide me a script? Thanks, Dawn (3 Replies)
Discussion started by: Dawn Bosch
3 Replies

2. Shell Programming and Scripting

Combine in single file

I have 2 files: phone.txt and mobile.txt ex. phone.txt MOBILENO|DISABLE_DATE 919687877754|9/1/2011| 919687877762|9/1/2011| 919687880573|9/1/2011| 919687882658|9/2/2011| Ex. mobile.txt MOBILENO |TIME 919687880573|2011-09-17 12:23:40| 919687882658|2011-10-10 21:15:33|... (4 Replies)
Discussion started by: khingx
4 Replies

3. Shell Programming and Scripting

How to find empty files in a directory and write their file names in a text?

I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only. (1 Reply)
Discussion started by: vel4ever
1 Replies

4. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

5. Shell Programming and Scripting

Find all the files under a specific directory and zip them into a single file.

Hi, Is there a way to find all the files from a specific location and then zip them into a single file, even if they are in multiple directories? (3 Replies)
Discussion started by: rudoraj
3 Replies

6. Shell Programming and Scripting

Combine Multiple Files into Single One File One after other

I am trying to combine 4 .dat files into one single Output file Inputs are:- file123.dat, file256.dat, file378.dat & file490 Expected Output:- FileName=file1 {text from file1} EOF {blank line} FileName=file2 {text from file2} EOF {blank line} FileName=file3 {text from file3} EOF... (4 Replies)
Discussion started by: lancesunny
4 Replies

7. Shell Programming and Scripting

Change to directory and search some file in that directory in single command

I am trying to do the following task : export ENV=aaa export ENV_PATH=$(cd /apps | ls | grep $ENV) However, it's not working. What's the way to change to directory and search some file in that directory in single command Please help. (2 Replies)
Discussion started by: saurau
2 Replies

8. Shell Programming and Scripting

Search Pattern and combine into single file

Hi Experts Please help me out with the following thing: 2 files and want the output file: {No for using FOR loop because I got 22 million lines} Tried that "It processes only 8000 records per hour" I need a faster way out !!! FileA: 9051 9052 9053 9054 9055 9056 9057 9058 9059 ... (5 Replies)
Discussion started by: navkanwal
5 Replies

9. Shell Programming and Scripting

Script to find directory is getting files in every 10 mins, if not then when last time file received

Dears, I am looking for a script which will work as a watch directory. I ha directory which keep getting files in every 10 mins and some time delay. I want to monitor if the directory getting the files in every 10 mins if not captured the last received file time and calculate the delay. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies
comb(1) 						      General Commands Manual							   comb(1)

Name
       comb - combine delta versions of SCCS file

Syntax
       comb [-o] [-s] [-psid] [-clist] files

Description
       The  command  generates	a shell procedure which, when run, will reconstruct the given SCCS files.  For further information, see The recon-
       structed files are generally smaller than the original files.  The arguments may be specified in any order,  but  all  keyletter  arguments
       apply  to  all  named  SCCS  files.   If a directory is named, behaves as though each file in the directory were specified as a named file,
       except non-SCCS files (last component of the path name does not begin with s.)  and unreadable files, which are	silently  ignored.   If  a
       name of - is given, the standard input is read; each line of the standard input is taken to be the name of an SCCS file to be processed.

       The generated shell procedure is written on the standard output.

       Each  keyletter	argument  is  explained  as though only one named file is to be processed, but the effects of any keyletter argument apply
       independently to each named file.

Options
       -clist	 Preserves specified deltas.  See for the syntax of a list.  All other deltas are discarded.

       -o	 Causes the reconstructed file to be accessed at the release of the delta to be created.  Otherwise the reconstructed  file  would
		 be  accessed  at the most recent ancestor.  Use of the -o keyletter may decrease the size of the reconstructed SCCS file.  It may
		 also alter the shape of the delta tree of the original file.

       -pSID	 Indicates oldest delta to be preserved.  All older deltas are discarded in the reconstructed file.

       -s	 Generates a shell procedure which produces a report.  This report gives the file name, size (in blocks) after combining, original
		 size (also in blocks), and percentage change computed by:
							      100 * (original - combined) / original
		 It  is   recommended  that  before any SCCS files are actually combined, one should use this option to determine exactly how much
		 space is saved by the combining process.

       If no keyletter arguments are specified, will preserve only leaf deltas and the minimal number of ancestors needed to preserve the tree.

Restrictions
       The command may rearrange the shape of the tree of deltas.  It may not save any space; in fact, it is possible for the  reconstructed  file
       to actually be larger than the original.

Diagnostics
       See for explanations.

Files
       s.COMB	     The name of the reconstructed SCCS file.
       comb?????     Temporary.
See Also
       admin(1), delta(1), get(1), help(1), prs(1), sccs(1), sccsfile(5)
       Guide to the Source Code Control System

																	   comb(1)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy