04-02-2011
Grep for filetype starting with letter p
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:
- Which files in /usr/bin whose names begin with “p” are python scripts? Store the numbered results in python_scripts.txt.
2. Relevant commands, code, scripts, algorithms:
See below?
3. The attempts at a solution (include all code and scripts):
find /usr/bin -type f -exec ls -na {} \; | grep "^p" | less
So i know that the ^ should be giving me the file starting with p but its not... and im not sure what or how to determine that a file is a python file... .py?
Could i use ls -X to get the files listed by file extension?
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Keene state KSC Keene NH USA Chalire Wilder CS125-01
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Can we find some of size of all files in a directry where file names start with an letter t*
the out put of ls -ls t* is
4 -rw-r--r-- 1 root system 61 Jul 03 10:56 t
4 -rw-r--r-- 1 root system 3146 Jul 19 11:11 t1
4 -rw-r--r-- 1 root system ... (2 Replies)
Discussion started by: pbsrinivas
2 Replies
2. UNIX for Dummies Questions & Answers
Hi ,,
i have the below file...
D 2342135
B 214236
C argjlksd
V lskjrghaklsr
C slkrgj
B sdg4tsd
E aslkgjlkasg
i want to sort the lines into different files based on the starting letter of the line. so that i have different files for lines starting with a letter.
thanks (1 Reply)
Discussion started by: jathin12
1 Replies
3. Shell Programming and Scripting
Hi,
I have lets say 10 files , I need to process them one by one.
So I need a command to get one file name at a time to process it into a variable
Example
Files
P1111.dat
P3344.dat
S344.dat
...
v_file_name = 'p111.dat' .. I will rename it to something after processing
... (1 Reply)
Discussion started by: prassu
1 Replies
4. Shell Programming and Scripting
Hello people,
I'm scratch my head to find a solution to my problem, I'm absolutely sure this is very simple!!! :wall:
I'm using the tcpdump to show on the screen in real time the UCP traffic:
tcpdump -l -i bond1 -s 1514 -nntttt -A src or dst 192.168.1.5 and port 10000 | egrep "/51/"The output... (5 Replies)
Discussion started by: Lord Spectre
5 Replies
5. Shell Programming and Scripting
I have an input file
12.4 1.72849432773174e+01 -7.74784188610632e+01
12.5 9.59432114416327e-01 -7.87018212757537e+01
15.6 5.20139995965960e-01 -5.61612429666624e+01
29.3 3.76696387248366e+00 -7.42896194101892e+01
32.1 1.86899877018077e+01 -7.56508762501408e+01
35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have a command that show some application information. Now, I have to grep there informations, like:
# showlog | grep 1266
1266.1369866124 ::
1266.1304711286 ::
41031.1161812668 ::
41078.1301266480 ::
41641.712662564 ::
1266.333792515 ::
41462.1512661988 ::
1266.54932671... (5 Replies)
Discussion started by: Lord Spectre
5 Replies
7. UNIX for Dummies Questions & Answers
Say I have a text file (allWords.txt), that contains all the words in the dictionary, line by line, that I would like to search through. Here is a snippet of what it might looks like...
Code:
a aah aahed aahing aahs aardvark aardvarks aardwolf ab abaci aback abacus abacuses abaft ......
I... (1 Reply)
Discussion started by: blackvelvet
1 Replies
8. Shell Programming and Scripting
Good afternoon all,
I want to ask how to change some letter in my file with other letter in spesific line
eg.
data.txt
1
1
1
0
0
0
0
for example i want to change the 4th line with character 1.
How could I do it by SED or AWK.
I have tried to run this code but actually did not... (3 Replies)
Discussion started by: weslyarfan
3 Replies
9. UNIX for Dummies Questions & Answers
Hi.
I'm trying to sort a list of items in a file alphabetically but starting from the letter 'X'. For instance if I had the following file;
test.txt
Z
A
T
W
Y
B
S
X
I would like the output to look like;
X
Y (8 Replies)
Discussion started by: mmab
8 Replies
10. UNIX for Dummies Questions & Answers
e.g.
File name: File.txt
cat File.txt
Result:
#INBOUND_QUEUE=FAQ1
INBOUND_QUEUE=FAQ2
I want to get the value for one which is not commented out.
Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies