Commands tagged sed (369)

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

view all lines without comments.

rename all files with "?" char in name
replace all "?" characters in filename to underscore

Count the number of pages of all PDFs in current directory and all subdirs, recursively

Figure out your work output for the day
Figures out what has changed in the last 12 hours. Change the author to yourself, change the time since to whatever you want.

get all Google ipv4 subnets for a iptables firewall for example
a bit shorter, parenthesis not needed but added for clarity

Recompress all .gz files in current directory using bzip2 running 1 job per CPU core in parallel

sort list of email addresses by domain.tld
email random list can be created here: https://www.randomlists.com/email-addresses

Randomly run command
Randomly decide whether to run a command, or fail. It's useful for testing purposes. . Usage: ran PERCENTAGE COMMAND [ARGS] Note: In this version the percentage is required. . This is like @sesom42 and @snipertyler's commands but in a USABLE form. . e.g. In your complicated shell script, put "ran 99" before a crucial component. Now, it will fail 1% of the time allowing you to test the failure code-path. $ ran 99 my_complex_program arg1 arg2

grep certain file types recursively
doesn't do case-insensitive filenames like iname but otherwise likely to be faster

grep (or anything else) many files with multiprocessor power
xargs -P N spawns up to N worker processes. -n 40 means each grep command gets up to 40 file names each on the command line.


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: