Tag Info

New answers tagged

5

You can use vi +$ /home/john/master/tried.cfg and do a way with the $() part completely. You don't have to escape the $ as it is followed by a space and bash doesn't expand it. You can also use this to go to, e.g. the one before last line: vi +\$-1 /home/john/master/tried.cfg but then you have to escape the $ with a backslash.


1

Using awk: awk 'BEGIN{FS=OFS="~";v=1111}{$3-=v; print $3}' file This outputs the modified file to stdout. A~Test1~8352~testA B~Test2~3714~testB To subtract TIME values (hhmmss format), the following works (as per your comment): input: A~Test1~203000~testA awk -v dif="014000" ' BEGIN{ FS=OFS="~" difS=toSec(dif) } { f3="" ...


1

I know this is an old question, but I've been beating my head over this for a few days now and I've finally got it. It turns out the solution is simple: update bash to 4.3. The default bash on Macs (even Yosemite) is 3.2. Install Homebrew with ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" then do brew install ...


4

You must search for <td>n. The escaped version searches for a single isolated word td followed by n. \<word\> pattern is useful for searching words even when they are separated by other stuff than whitespace or appear at the beginning or end of the line. So try: /<td>name=


4

As far as I know Drav Sloan is correct: there is no universal "vi" mode setting. You can ease the pain for a lot of more modern command line programs by having a file named $HOME/.inputrc with this line in it: set editing-mode vi A lot of programs use readline, gnuplot, psql, impala-shell and others. This may get you most of way to where you want to be.


0

I added those keys : bindkey -M vicmd '?' history-incremental-search-backward bindkey -M vicmd '/' history-incremental-search-forward I do as CTRL+R in emacs mode and I prefer



Top 50 recent answers are included