awk has a command for this:
$ awk '{print $2}' <filename>
You can, of course, also pipe in text output from another program:
$ who
noah console Oct 21 14:06
noah ttys000 Oct 23 13:08
noah ttys001 Oct 23 14:00
| def pick(d, filter_tree): | |
| '''Returns a new dictionary by picking keys/values from d per filter_tree. | |
| Works recursively: values in filter_tree can be either True or dictionaries | |
| which are their own filters. | |
| >>> d = {'a': 1, 'b': 2, 'c': {'foo': -1, 'bar': -2}, 'd': {'r': 'red', 'b': 'blue'}} | |
| >>> pick(d, {'a': True, 'b': True}) | |
| {'a': 1, 'b': 2} | |
| >>> pick(d, {'a': True, 'b': True, 'd': True}) | |
| {'a': 1, 'b': 2, 'd': {'r': 'red', 'b': 'blue'}} |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Hack to block re-rendering child when parent was updated</title> | |
| <script src="https://fb.me/react-0.13.0.js"></script> | |
| <script src="https://fb.me/JSXTransformer-0.13.0.js"></script> | |
| </head> | |
| <body> | |
| </body> |
| #!/usr/bin/env bash | |
| # lintjs.sh | |
| REPO_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) | |
| JS_FILES=$(find . \ | |
| -not -path '*node_modules*' \ | |
| -not -path '*module-cache*' \ | |
| -not -path '*/lib/*' \ | |
| -not -name '*.min.js' \ |
| [ignore] | |
| [include] | |
| [libs] | |
| ./lib.js | |
| [options] |
| /* | |
| * TOA = TON + NPI | |
| * See TS 24.008 section 10.5.4.7 for details. | |
| * These are the only really useful TOA values | |
| */ | |
| public static final int TOA_International = 0x91; | |
| public static final int TOA_Unknown = 0x81; |
| mapM_ putStrLn [ if x `mod` 15 == 0 then "fizzbuzz" else if x `mod` 3 == 0 then "fizz" else if x `mod` 5 == 0 then "buzz" else show x | x <- [1..100]] |
| <html> | |
| <!-- | |
| Copyright (c) 2013 Noah Tye <[email protected]> | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| # add this to your .bash_profile to use it | |
| # source: https://gist.github.com/noahlt/2662634 | |
| function killport { | |
| if [ ! -n "$1" ] || [ $1 == '--help' ] || [ $1 == '-h' ] | |
| then | |
| echo '`killport <PORT>` finds the process listening to the specified port and kills it.' | |
| else | |
| process_line=`sudo lsof -i :$1 | tail -1` | |
| if [ "$process_line" == "" ] | |
| then |
| <html> | |
| <head> | |
| <style> | |
| body * { background-color: #FCF0AD; } | |
| body *:hover { background-color: blue; } | |
| *:hover { background-color: blue; } | |
| body li:hover { background-color: red; } | |
| </style> | |
| <body> |
awk has a command for this:
$ awk '{print $2}' <filename>
You can, of course, also pipe in text output from another program:
$ who
noah console Oct 21 14:06
noah ttys000 Oct 23 13:08
noah ttys001 Oct 23 14:00