04-20-2011
Many files have text internally, and I am not sure there is a magic for plain text, so file might not be that useful. I actually wrote a pctbin C command to find out what percentage of characters were not in the common ASCII text file set: ' ' through '~', line feed, carriage return, form feed. The trick is figuring out what your professor defines as text!
You can find * -type f | xargs -n999 file and see all the types you have, and write a grep -E pattern that will select or deselect so only text types survive. You can use sed to remove the suffix of ": file type".
The permission are visible in find -ls or ls -l, and you can grep for them, too. Sorting by date is easy with ls -t, but ls has a file count limit. If you use the date, watch out for ls -l having a date-time form for one year and then a date-year form. I wrote a trivial C to take a stream of file name lines and spit them back out prefixed with the mtime.
Hope this helps!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Iam trying to sort the contents of the file based on the position of the file.
Example:
$cat sample.txt
0101020060731 ## Header record
1c1 Berger Awc ANP20070201301 4000.50
1c2 Bose W G ANP20070201609 6000.70
1c2 Andy CK ANP20070201230 28000.00... (3 Replies)
Discussion started by: ganapati
3 Replies
2. UNIX for Dummies Questions & Answers
Hi Guru's,
I need to create 3 files with the contents "ABC" using single command.
Iam using:
echo "ABC" > file1.txt file2.txt file3.txt
the above command is not working. pls help me...
With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies
3. UNIX for Dummies Questions & Answers
Dear all,
It's not entirely clear to me from manpage the difference between them.
Why we still need "-u" flag?
- monkfan (3 Replies)
Discussion started by: monkfan
3 Replies
4. Shell Programming and Scripting
Hi,
sorry for bothering with this easy problem but I can't understand...
I've a file like this:
"4","0x23a3"
"5","0x4234"
"11",""
"20",""
"11132","0x6456"
I would like to create a file like this:
4,23a3
5,4234
11,999999
20,999999
11132,6456
I've tried:
cat INPUT.txt | sed -e... (7 Replies)
Discussion started by: TheMrOrange
7 Replies
5. Shell Programming and Scripting
Hi experts
I want your help to change the file format to my wanted version, please give me a hand thanks
$cat file
install pass
make os pass
make build kernel failed
usb storage pass
chane to
| *install* | *make os* | *make build kernel* | *usb storage* |
| pass | pass... (7 Replies)
Discussion started by: yanglei_fage
7 Replies
6. Shell Programming and Scripting
Hello everyone
Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried
sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies
7. Shell Programming and Scripting
Hi all.
I have a .txt file that I need to sort it
My file is like:
1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO)
2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies
8. Shell Programming and Scripting
Hi Experts,
I have a string with colon delimited, want 2nd colon to be changed to a pipe.
data:
101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3:
I am trying with sed, but can change only 1 occurance:
echo "101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3:" | sed 's/:/|/2'... (5 Replies)
Discussion started by: rveri
5 Replies
9. Shell Programming and Scripting
I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies
10. Programming
Hello everyone,
Since my python knowledge is limimted, I've challenged myself to learn as much as possible to help me with my carrere. I'm currently trying to convert a shell script to python, just to give myself a task. There is one section of the script that I'm having issues converting and... (2 Replies)
Discussion started by: da1
2 Replies
ecppc(1) Tntnet users guide ecppc(1)
NAME
ecppc - compiler for ecpp
SYNOPSIS
ecppc [-bhszvtM] [-s-] [-o filename] [-n name] [-m mimetype] [--mimetypes filename] [-I dir] [-l log-category] filename
ecppc -bb filename...
DESCRIPTION
Ecppc is the compiler for the ecpp-language. Ecpp is a template-language, which lets the user embed C++-code into HTML for use in tntnet
(8). Ecppc generates a C++-class from a ecpp-template. It can also compile binary data into a C++-class, which makes it possible to inte-
grate them in a tntnet-application.
OPTIONS
-b This enables binary-mode. Ecppc does not look for ecpp-tags, but creates a class, which just copies the data
-bb This enables multi-binary-mode. Every binary-file has some overhead, when packed into a tntnet-application. This overhead can be
quite significant, when binary-files are small, like small icons in a web application. To reduce this overhead, multiple binaries
can be packed into a single class, which removes the per-binary overhead completely.
When the component is called, it uses the path-info-parameter (request.getPathInfo()) from the request, to decide, which binary to
send. If no filename matches the path-info, processing is declined. The binaries need not be of same mime-type, since the mime-
type is looked automatically from the mime-database by file-extension of the source-file.
-I dir Search include-files in directory. This option can be passed multiple times. All specified directories are searched in turn for
include-files.
-l log-category
Set log category. Default is "component.componentname".
-L Disable generation of #line-directives
-m mimetype
Set mimetype of output. This is the mimetype, sent by the component to the browser in the Content-Type-header. Without this param-
eter the mimetype is looked up from the mime-database of your system using the file-extension of the source-file.
--mimetypes file
Read mimetypes from file (default: /etc/mime.types).
-M This disables normal processing and prints just the ecpp-dependencies from this component. The output can be included into a Make-
file. Ecpp-dependencies are introduces by the <%include>-tag.
-n name
Set the name of the component. Normally this is derived from the source-file-name by removing the path and .ecpp-extension.
-o filename
Write the generated file to the specified file instead of deriving the filename from the source-file-name. The outputfilename is
normally the source-file where the extension is replaced by .cpp.
-p Keep path name when deriving name of component from input file name.
-s Generate singleton. Normally ecppc decides automatically, if the template is suitable for a singleton. This option force ecppc to
generate a singleton.
-s- Do not generate a singleton.
-v Enable verbose mode. This prints additional information about the processing on the standard-output.
-z Compress the data in the component. Compressed data is automatically decopressed on first use. This reduces the code-size, but
slightly slows down the first call of the component.
AUTHOR
This manual page was written by Tommi Makitalo <tommi@tntnet.org>.
SEE ALSO
tntnet(1), ecpp(7), ecppl(1), ecppll(1).
Tntnet 2006-07-23 ecppc(1)