New answers tagged

-1

I tried: for zip file: zipgrep -s "pattern" *.zip for .gz file zgrep "pattern" .* Note: zgrep use same option as grep.


1

An awk solution: awk '$0!~/.*[[:alpha:]][[:digit:]]+$/ && $0!~/^[[:digit:]]+[[:alpha:]]+/' words.txt 789 hello he11o 88888


1

To actually edit the source file and create a new file with the discards is a bit trickier. I would do this $ cat file 789 hello 1hello 112121hello3323 he11o hello9 88888 $ perl -i -lne 'if (/^\d+\D|\D\d+$/) {warn "$_\n"} else {print}' file 2>file_nums $ cat file 789 hello he11o 88888 $ cat file_nums 1hello 112121hello3323 hello9 The matched lines ...


2

GNU grep grep -vP '^\d+\D|\D\d+$' produces 789 hello he11o 88888


0

Did a little tweak to purplepsycho solution for i in {1..152} do sed -i.bak -e "s/[[i]]/[[$i]]]/g" plot_vents_$i done Thanks!


1

In bash: for i in {1...152} do sed -i.bak -e "s/[[i]]/[[$i]]/g plot_$i done This script will run sed on each file, and backup them before replacing the string.


1

yes it can! ;-) right-click on the MATE/Mint-menu and open the Preferences: go to the Applications-tab and uncheck Remember the last category or search (it should be the last item). normally (on LinuxMint MATE) this is unchecked by default...!


1

I'm absolutely new to emacs but I can suggest the following: M-b to move backward over a word M-d to kill up to the end of the word Now you can write a new word. Works almost like cw in vim


1

The "simple" answer is to use sed: sed -n 's/.*\("[^"]*"\),"confidence".*/\1/p' filename This will print "I win".  To exclude the quotes (and get just I win as the output), move the first two double quotes in the command outside of the parentheses: sed -n 's/.*"\([^"]*\)","confidence".*/\1/p' filename The better answer is to get a tool that's designed to ...


1

It's JSON, and linux tools are not very good for working with JSON. And your conditions are not very clear... But this perl one-liner produces from your example string "I win" perl -0777 -nE 's/.*"(.+?)","confidence".*/$1/s; say'



Top 50 recent answers are included