Delete all the lines after PATTERN

Tag(s):

# To delete all the lines after PATTERN, use this
sed '/PATTERN/,$d' input.txt

https://nixtricks.wordpress.com/2013/01/09/sed-delete-the-lines-lying-in-between-two-patterns/

Get mutiple line text between 2 patterns

Tag(s):

# Note: PATTERN-1 & PATTERN-2 will be also included in your result.
sed -n '/PATTERN-1/,/PATTERN-2/p' input.txt

http://stackoverflow.com/questions/15685471/sed-get-text-between-lines

Egit: Remove git commit

Tag(s):

  1. Right-click on your project name.
  2. Go to Team->Show in History.
  3. Select the last good commit that you want.
  4. Right-click and select Reset->Hard (HEAD, Index, and working Directory).

http://stackoverflow.com/questions/13534336/how-to-delete-commits-with-egit#13797416

Time commands execution

Tag(s):

# Bash built-in time
TIMEFORMAT=%R; time sleep 2s
#2.003
 

Use readlink instead of realpath

Tag(s):

Use readlink instead of realpath because readlink is ubiquitous.

readlink -ev FILE

Mass copy data

Tag(s):

  1. Use cp.
  2. Use rsync to recheck or when cp get interrupted.

Pages

Subscribe to OpenWritings.net RSS