Skip to content

Commit 4d1fa8c

Browse files
committed
add awk NF-1 usage
1 parent 9c31dca commit 4d1fa8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bashrc/oneline_cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,9 @@ pip install django --index-url http://pypi.douban.com/simple
172172
# match [xxx] and [xxx] content.
173173
grep -Po '(?<=\[)[^]]+'
174174
ifconfig | grep -oP '(?<=inet addr:).*(?= Bcast:)' | xargs -n 4
175+
176+
# awk usage
177+
# pattern { action statements }
178+
# function name(parameter list) { statements }
179+
# awk '/pattern/ { action }' and '{if($1==pattern) action}'
180+
ps aux | awk '{if($1=="root") print $(NF-1)}'

0 commit comments

Comments
 (0)