how to change this looking for mimetype "text/plain" instead of extension *.txt?
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Create a Shell script that looks for all text files in your home directory (including subdirectories).
List only text files that all members of your group are able to "read and write".
These files shall be listed in the order "date of last change on file".
The permissions on and the full path of each file shall be listed, too.
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
This is my solution (until now):
Here I'm looking for the file's extension "*.txt" but actually I've to look for the mime-type or so. Therefor the "file command" exists but I've no idea to adopt the mime-type into my script instead of the extension's search?
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
HAW Hamburg, Hamburg (Hamburg), Germany, Schneider, BS,http://ds2.etech.haw-hamburg.de/snd/veranst.html
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.
What Operating System and version are you running? It really matters for this type of question because there are extensions to standard unix commands available in some versions of Linux which could help.
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)
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)
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)
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)
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)
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)
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)
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)
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)