How to read those files and output to base?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to read those files and output to base?
# 1  
Old 10-22-2007
How to read those files and output to base?


HTML Code:
-rwxr-xr-x  1 abc mkpasswd 2483 Oct 20 15:42 0132200710-ps5_cdrm.unl
-rwxr-xr-x  1 abc mkpasswd 1826 Oct 20 15:43 0132200710-ps5_cdrn.unl
-rwxr-xr-x  1 abc mkpasswd 1788 Oct 20 15:44 0132200710-ps5_cdro.unl
-rwxr-xr-x  1 abc mkpasswd 1681 Oct 20 15:44 0132200710-ps5_cdrp.unl
-rwxr-xr-x  1 abc mkpasswd 1373 Oct 20 15:45 0132200710-ps5_cdrq.unl
-rwxr-xr-x  1 abc mkpasswd 1371 Oct 20 15:45 0132202469-ps5_cdrm.unl
-rwxr-xr-x  1 abc mkpasswd 1559 Oct 20 15:46 0132202469-ps5_cdrn.unl
-rwxr-xr-x  1 abc mkpasswd 2121 Oct 20 15:47 0132202469-ps5_cdro.unl
I have list of files as above for eg, I wanted to have my end output result for all
0132200710*unl to be in one single file, and all 0132202469*unl and so forth..

Please help.
# 2  
Old 10-22-2007
check the cat man page.
# 3  
Old 10-22-2007
You can do something like that :
ls *-*.unl | \
while read file
   root=$(echo $file | cut -d- -f1)
   cat $file >> $root.unl

# 4  
Old 10-22-2007
With zsh:
set -- *unl
for f (${(u)${@%-*}}) print -rl "$f"*>"$f"_all

for f in *unl;do printf "%s\n" "$f">>"${f%-*}"_all;done

# 5  
Old 10-22-2007
hey just try,
ls -1 <<search pattrn>>*unl >> filename.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Read in Multiple log files and output selected variables and values to cvs file

I have several problems with my problems: I hope you can help me. 1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error. For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Discussion started by: dellanicholson
0 Replies

2. Shell Programming and Scripting

Combine data from two files base on uniq data

File 1 ID Name Po1 Po2 DD134 DD134_4A_1 NN-1 L_0_1 DD134 DD134_4B_1 NN-2 L_1_1 DD134 DD134_4C_1 NN-3 L_2_1 DD142 DD142_4A_1 NN-1 L_0_1 DD142 DD142_4B_1 NN-2 L_1_1 DD142 DD142_4C_1 NN-3 L_2_1 DD142 DD142_3A_1 NN-41 L_3_1 DD142 DD142_3A_1 NN-42 L_3_2 File 2 ( Combination of... (1 Reply)
Discussion started by: pareshkp
1 Replies

3. Programming

Finding duplicate files in two base directories

Hello All, I have got some assignment to complete till this Monday and problem statement is as follow :- Problem :- Find duplicate files (especially .c and .cpp) from two project base directories with following requirement :- 1.Should be extendable to search in multiple base... (4 Replies)
Discussion started by: anand.shah
4 Replies

4. Shell Programming and Scripting

Read in 2-column CSV, output many files based on field

Is there a way to read in a two-columned CSV file, and based on the fields in 1st column, output many different files? The input/output looks something like: input.csv: call Call Mom. call Call T-Mobile. go Go home. go Go to school. go Go to gas station. play Play music. play Play... (4 Replies)
Discussion started by: pxalpine
4 Replies

5. Solaris

Move files to another folder base on DU

Hi, I want to move files like *.txt to another filesystem on the same server only when the disk usage reaches 80% or more. But need to keep the latest 5 files. After that delete from the original. How to proceed? Please help Gav... (5 Replies)
Discussion started by: Gavisht
5 Replies

6. Red Hat

CentOS 6.1 base install (like FreeBSD base install)?

Hello, What is the simplest way to install CentOS 6.1 with console base-system only using official LiveDVD image on VirtualBox machine? I'd like to get simplest console with network support like FreeBSD base installation. Then, install services which I need. The installer jest extracts the... (2 Replies)
Discussion started by: newbie_develope
2 Replies

7. Shell Programming and Scripting

to read two files, search for patterns and store the output in third file

hello i have two files temp.txt and temp_unique.text the second file consists the unique fields from the temp.txt file the strings stored are in the following form 4,4 17,12 15,65 4,4 14,41 15,65 65,89 1254,1298i'm able to run the following script to get the total count of a... (3 Replies)
Discussion started by: vaibhavkorde
3 Replies

8. Shell Programming and Scripting

Script to read input and output files and child scripts

I have a directory where i have *.sas; *.pl;*.sh and *.c scripts I need to find out what are the child scripts and input output files for each script: say I have a shell script which calls a perl script and a sas script: In my first line I want I a) the parent script name; b) the... (1 Reply)
Discussion started by: ramky79
1 Replies

9. UNIX for Advanced & Expert Users

read() wont allow me to read files larger than 2 gig (on a 64bit)

Hi the following c-code utilizing the 'read()' man 2 read method cant read in files larger that 2gig. Hi I've found a strange problem on ubuntu64bit, that limits the data you are allowed to allocate on a 64bit platform using the c function 'read()' The following program wont allow to allocate... (14 Replies)
Discussion started by: monkeyking
14 Replies

10. Shell Programming and Scripting

Read multiple log files and create output file and put the result

OS : Linux 2.6.9-67 - Red Hat Enterprise Linux ES release 4 Looking for a script that reads the following log files that gets generated everynight between 2 - 5am Master_App_20090717.log Master_App1_20090717.log Master_App2_20090717.log Master_App3_20090717.log... (2 Replies)
Discussion started by: aavam
2 Replies
Login or Register to Ask a Question