Could you please advise how can one extract from the output of
find . -name "*.c" -print
only filenames in the current direcotry and not in its subdirectories?
I tried using (on Linux x86_64)
find . -name "*.c" -prune
but it is not giving correct output.
Other than prune, is it possible to pipe GREP with find to get desired output?
If you don't want to descend into subdirectories, the simple way to do this is:
Note that in the ls option -1 that is the digit one, not the letter ell.
Or, if you just want to see how pruning would work using a basic regular expression in grep instead of a filename pattern match in the shell, use:
If you wonder why the $ is there, try running the above command with and without the $ in a directory in which there is a file named source.cpp and a file named source.c.
If you wonder why you need [.] instead of just . in a BRE, try the command above with and without the $ and with and without the square brackets in a directory that contains the files named before and files named abc, bcd, and c.
I am new to shell scripts.Can u please help me on this req.
test_user = "Arun"
if
echo "test_user is a word"
else
echo "test_user is not a word" (1 Reply)
Hello,
I need help with using grep and regular expressions....
I have a long list of about 1000 lines of Chinese flashcards. Here's a small excerpt:
意文 yìwén (given name)
貴姓 guìxìng (honorable surname)
貴 guì (honorable)
姓 xìng (one's surname is; to be surnamed; surname)
呢 ne (interrogative... (2 Replies)
I have a file that I'm trying to find all the cases of phone number extensions and deleting them. So input file looks like:
abc
x93825
def
13234
x52673
hello
output looks like:
abc
def
13234
hello
Basically delete lines that have 5 numbers following "x". I tried: x\(4) but it... (7 Replies)
what elements does " /^/ " match?
I did the test which indicates that it matches single lowercase character like 'a','b' etc. and '1','2' etc.
But I really confused with that. Because, "/^abc/" matches strings like "abcedf" or "abcddddee".
So, what does caret ^ really mean?
Any response... (2 Replies)
In regular expressions with grep(or egrep), ^ works if we want something in starting of line..but what if we write ^^^ or ^ for pattern matching??..Hope u all r familiar with regular expressions for pattern matching.. (1 Reply)
I have a flat file with the following drug names
Nutropin AQ 20mg PEN Cart 2ml
Norditropin Cart 15mg/1.5ml
I have to extract digits that are before mg i.e 20 and 15 ; how to do this using regular expressions
Thanks
ram (1 Reply)
how to find for a file whose name has all characters in uppercase after 'project'?
I tried this:
find . -name 'project**.pdf'
./projectABC.pdf
./projectABC123.pdf
I want only ./projectABC.pdf
What is the regular expression that correponds to "all characters are capital"?
thanks (8 Replies)
I have following content in the file
CancelPolicyMultiLingual3=U|PC3|EN
RestaurantInfoCode1=U|restID1|1
.....
I am trying to use following matching extression
\|(+)
to get this
PC3|EN
restID1|1
Obviously it does not work.
Any ideas? (13 Replies)
How can i create a regular expression which can detect a new line charcter followed by a special character say * and replace these both by a string of zero length?
Eg:
Input File san.txt
hello
hi ... (6 Replies)