Commands tagged awk (348)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Execute matlab sentences from command line
Execute matlab sentences in shell script: for var in `seq 0 0.2 1` ; do echo "my_function($var);" | matlab -nodisplay done

Convert files from DOS line endings to UNIX line endings
Here "^M" is NOT "SHIFT+6" and "M". Type CTRL+V+M to get it instead. Its shortest and easy. And its sed!, which is available by default in all linux flavours.. no need to install extra tools like fromdos.

generate random number

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Check a server is up. If it isn't mail me.
Joker wants an email if the Brand X server is down. Set a cron job for every 5 mins with this line and he gets an email when/if a ping takes longer than 3 seconds.

Save your terminal commands in bash history in real time
Use this command if you want your terminal commands be saved in your history file in real time instead of waiting until the terminal is closed

Print just line 4 from a textfile
this method should be the fastest

Watch the progress of 'dd'
The previously-posted one-liner didn't work for me for whatever reason, so I ended up doing this instead.

Display your ${PATH}, one directory per line
This works in bash and zsh. You may also want to alias it, if you need to look at it often... $ alias lpath="echo \$PATH | tr : \\\\n" "\$PATH" to make sure to look at your current $PATH

Remount an already-mounted filesystem without unmounting it
Necessary for fsck for example. The remount functionality follows the standard way how the mount command works with options from fstab. It means the mount command doesn't read fstab (or mtab) only when a device and dir are fully specified. After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command. It does not change device or mount point.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: