How to read and append certain files form directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to read and append certain files form directory
# 1  
Old 02-09-2011
How to read and append certain files form directory

Hi ,i have a question ,if I am in sertain directory and I have 4 files *.c
how can I read and append this files in file backup.bac
Thanks


Code:
find ./ -name "*.csh" | wc -l

# 2  
Old 02-09-2011
Code:
cat *.c >> backup.bac

This User Gave Thanks to Corona688 For This Post:
# 3  
Old 02-09-2011
Thanks

Last edited by lio123; 02-09-2011 at 03:32 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Append pipe | at the end of all the rows except header n trailer for all the files under a directory

Hi Experts Need help... I am looking for a Unix script to append pipe | at the end of all the rows (except header and trailer)in all the files placed under the directory /interfaces/Temp e.g. Header row1 row2 row3 Trailer The script should read all the files under... (3 Replies)
Discussion started by: phani333
3 Replies

2. 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

3. Shell Programming and Scripting

Read multiple files, parse data and append to a file

Hi..Can anyone suggest a simple way of achieving this. I have several files which ends with extension .vcf . I will give example with two files In the below files, we are interested in File 1: 38 107 C 3 T 6 C/T 38 241 C 4 T 5 C/T 38 247 T 4 C 5 T/C 38 259 T 3 C 6 T/C... (8 Replies)
Discussion started by: empyrean
8 Replies

4. Shell Programming and Scripting

append text to column in all files of directory

Hi, I want to append "chr" to all col 2 values of all files in a particular folder. This is what I came up with but isnt working. Please help. ls -1 * | ( while read line do awk 'BEGIN {FS=OFS=":"} {$2="chr"$2;print $0}' $line > $line_new done ) Another question is, how to delete... (7 Replies)
Discussion started by: alpesh
7 Replies

5. Programming

C program to read n files and append it to a variable.

I am struck in the code of handling multiple files reading and appending it into a variable. My First file's entire content I have concatenated using strcat(<char pointer>,char array) In the Second file I extract using strtstr() function and below is the code. if( fp2 != NULL){ ... (2 Replies)
Discussion started by: gameboy87
2 Replies

6. Shell Programming and Scripting

Append variable texts to the beginning of each line in all files in a directory

I am writing a code to append some numbers in the beginning of each line in all the files present in a directory. The number of files are really huge. The files are numbered as 1.sco, 2.sco, 4.sco (Note: 3.sco is missing). The files currently look like this: 1.sco 2 3 5 6 6 7My task is to... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

7. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

8. Shell Programming and Scripting

search directory-find files-append at end of line

Hi, I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command. example of an entry in the file :- get_data -x -m50 /etc/web/getid this... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

9. Shell Programming and Scripting

read files from directory

hi i have a directory /tmp/Satya,it contains 5.FILE 6.FILE 7.FILE i need to read each file , and read its content line by line please help thanks Satya (2 Replies)
Discussion started by: Satyak
2 Replies

10. UNIX for Dummies Questions & Answers

Read Files from a Directory

Hi, I have a requirement where I have get the files from FTP server then delete the files in the FTP server and then store the file name within the file where there is "TR". i.e Filename|TR|20071231|.... Once I finish loading my file I have to archive the files. Is there any way to do it... (2 Replies)
Discussion started by: kiran_418
2 Replies
Login or Register to Ask a Question