LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 09-18-2013, 06:00 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,149

Rep: Reputation: 46
Find all files, in a given tree, that are ascii text files?


Hi: a one-liner to recursively find all files, under the working directory, that are ascii text files?
 
Old 09-18-2013, 06:11 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,491

Rep: Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621
For a starter:
Code:
find . -type f -exec file {} + | grep ASCII
It has a few faults -
  • A file with the string "ASCII" anywhere in its path will be listed regardless of its content,
  • Paths containing a colon will be hard to parse from the output,
  • Ditto for path components with embedded newline characters.
How bulletproof do you need it to be?
 
Old 09-18-2013, 06:15 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,149

Original Poster
Rep: Reputation: 46
I seem to have lost a text file documenting what the last working version of a program is. I can examine the 'file' command's output visually. They are not more than five or six.
 
  


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
How to insert Unicode (or extended ASCII) characters in text files? tommyttt Linux - General 4 12-28-2012 05:28 PM
[SOLVED] how to list all ascii/text files in a folder recursively? suhasingale Linux - Newbie 3 11-18-2011 01:28 PM
LXer: How to transform (almost) plain ASCII text to Lulu-ready PDF files LXer Syndicated Linux News 0 10-19-2010 05:40 PM
join 2 text files based on first number present in every line of the 2 text files markraem Linux - Software 4 01-25-2010 06:26 AM
Find string pattern in directory of text files magnum818 Linux - Newbie 2 10-15-2003 08:19 PM


All times are GMT -5. The time now is 02:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration