LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2017, 02:45 PM   #1
atjurhs
Member
 
Registered: Aug 2012
Posts: 316

Rep: Reputation: Disabled
recursively listing files' first lines


hey guys,

i have a directory tree structure with files that looks like this

Code:
/home/sub1/
/home/sub1/dog.csv
/home/sub1/colors.csv
/home/sub1/sub2/
/home/sub1/sub2/sub3/
/home/sub1/sub2/sub3/cars.csv
inside each of the csv files there is a header field separated by csv

for example: dog.csv would have as its header fields
Code:
dog1, dog2, dog3
and for colors.csv would have as its header fields
Code:
red, white, blue
and for car.csv would have as its header fields
Code:
Ford, Chevy, Dodge

when i use
Code:
find * -exec cat {}/;
or
Code:
find * print0 | xargs -0 cat
i get a listing, but it's a mess and not easily readable!

I would like the output something more human readable, maybe something like this, but I'm open to other human readable results.

Code:
/sub1/dog.csv
    dog1, dog2, dog3
/sub1/colors.csv
    red, white, blue
/sub2/
/sub3/cars.csv
    Ford, Chevy, Dodge
note: my system does not have tree as a command.
I'm guessing that it will take some sort of an awk script

thanks for whatever help you might give!

Todd
 
Old 03-28-2017, 03:37 PM   #2
atjurhs
Member
 
Registered: Aug 2012
Posts: 316

Original Poster
Rep: Reputation: Disabled
ended up using python
 
Old 03-28-2017, 03:41 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Can you share your code so someone in future with similar question can find it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursively listing files using bash builtins Neville Hillyer *BSD 3 01-21-2016 01:43 AM
[SOLVED] listing files recursively, sorted by time, limited head Harju Linux - Newbie 12 03-25-2011 11:51 AM
listing all the permissions recursively linuxfia Linux - General 4 10-31-2008 03:55 PM
Recursively listing files over FTP? overbored Linux - Software 4 10-14-2004 01:12 PM
recursively listing directories full paths kubicon Linux - Newbie 2 02-22-2004 04:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration