how to cat files with path? Help plz


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to cat files with path? Help plz
# 8  
Old 01-08-2008
Quote:
Originally Posted by zdn3023
Hi,
I am trying to organize my data files and I would like to know how to cat files with path. Note that the correct command may not be "cat" though.
For example, I have:
abc/data/1/title
dca/data/2/title
gpd/data/1/title
....

I'd like to have a file listing the title info from different directories, as well as directory paths.

Thanks

Simon
Code:
find /path/to/files -type f -name "title" -exec nawk 'FNR==1{print FILENAME":"$0}' {} \;

# 9  
Old 01-08-2008
Quote:
Originally Posted by Smiling Dragon
Not sure what you mean... Does the code not work? What error do you get?
I typed:
echo ${find */pdata/* -type f -name "title"}:`head -1 $file`
And the computer showed Variable syntax.
I have to say that I only know basic operations of Unix system.

Thanks,
# 10  
Old 01-09-2008
Thank you, gus2000
Your code:
find . -name "title" -type f -exec grep . {} /dev/null \;

works!
Thanks for you all who try to help.

Simon
# 11  
Old 01-09-2008
Quote:
Originally Posted by zdn3023
I typed:
echo ${find */pdata/* -type f -name "title"}:`head -1 $file`
And the computer showed Variable syntax.
I have to say that I only know basic operations of Unix system
That code snippet doesn't look valid to me, where did you get it from?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

2. Shell Programming and Scripting

CAT 3 files with the same name in 3 different folders

I am trying to cat 3 files. They all have the same name MFExtract.txt. But, they are in 3 seperate file names. Any idea how I could cat the 3 together. It's throwing me off figuring out a way because the names are the same. I was thinking just doing a 3 cat commands with the full path names and... (2 Replies)
Discussion started by: risarose87
2 Replies

3. Shell Programming and Scripting

Cat files situation

Hello, I am PhD student (Biomedical sciences) and very new to Linux. I need some help with the following task : I have files in the following format for their names : An_A1_nnn_R1.txt; An_A1_nnm_R1.txt; An_A1_nnoo_R1.txt An_A2_nnn_R1.txt; An_A2_nnm_R1.txt; An_A2_nno_R1.txt ... (8 Replies)
Discussion started by: Julio Finalet
8 Replies

4. Shell Programming and Scripting

cat certain files in directories to files named after the dir?

Hi all, I have a directory with many subdirectories each named like so: KOG0001, KOG0002, ...KOG9999. Each of these subdirectories contain a variable number two kinds of files (nuc and prot) named like so: Capitella_sp_nuc_hits.fasta (nuc) and Capitella_sp_prot_hits.fasta (prot). The... (2 Replies)
Discussion started by: kmkocot
2 Replies

5. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

6. UNIX for Dummies Questions & Answers

cat files

Hi, I was a typical Windows guy. Like to do things just by clicking my mouse:cool:. I got a new job now...where they are big on unix. I am trying to wet my fingures now with unix. Haven't taken the dive yet. I am trying to find a solution for this problem. Please help me with some... (4 Replies)
Discussion started by: sandeep78
4 Replies

7. Shell Programming and Scripting

shell script to call other files..plz help

Hi all, I have a number of shell script,perl script.. etc in a directory,which i need to execute in some order.Now i need to create a script to call all these files in that order..so that the new script will execute all the files one by one....plz help this is urgent. Thanks In advance Anju (3 Replies)
Discussion started by: anju
3 Replies

8. Shell Programming and Scripting

Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all, I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent. Thanks in Advance Anju (3 Replies)
Discussion started by: anju
3 Replies

9. Shell Programming and Scripting

cat /proc/ files

Hi, I need to write a shell script that should lists only the files that starts with alphabet from the /proc dir and then I have to cat those files and redirect to a file. But my below script is not working. It is reading the first file properly but not the subsequent files. Please throw a... (2 Replies)
Discussion started by: royalibrahim
2 Replies

10. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
Login or Register to Ask a Question