using grep I want to find all the strings like this: .some_char
. I have a text like this:
Lorem ipsum dolor sit amet**,c**onsectetur adipisici elit**,s**ed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat
i want to find ",c" ",s" . So i need a regex. Can you help me?
SOLUTION:
cat file.txt | grep -o -E ",[a-zA-Z0-9]"
The regex should be
",."
Furthermore you need to set some additional flag in grep
(-o to print only the matching part)
The full command is thus:
grep -r ",." -o
The question is a bit unclear. If by some_char you mean alphabetic characters, you could do
grep -o ',[A-Za-z]'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.