Commands using sed (1,319)

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

find . -name

mirrors directory to a ftp server
http://lftp.yar.ru/

Execute most recent command containing search string.
Execute the most recent command containing search string. This differs from !string as that only refers to the most recent command starting with search string.

Interactively build regular expressions
txt2regex can be interactive or noninteractive and generates regular expressions for a variety of dialects based on user input. In interactive mode, the regex string builds as you select menu options. The sample output here is from noninteractive mode, try running it standalone and see for yourself. It's written in bash and is available as the 'txt2regex' package at least under debian/ubuntu.

Replace spaces in a file with hyphens

SMS reminder
Send an e-mail to SMS reminder in 15 minutes from now, to call my wife. See list of carriers bellow Carrier Email to SMS Gateway Alltel [10-digit phone number]@message.alltel.com AT&T (formerly Cingular) [10-digit phone number]@txt.att.net [10-digit phone number]@mms.att.net (MMS) [10-digit phone number]@cingularme.com Boost Mobile [10-digit phone number]@myboostmobile.com Nextel (now Sprint Nextel) [10-digit telephone number]@messaging.nextel.com Sprint PCS (now Sprint Nextel) [10-digit phone number]@messaging.sprintpcs.com [10-digit phone number]@pm.sprint.com (MMS) T-Mobile [10-digit phone number]@tmomail.net US Cellular [10-digit phone number]email.uscc.net (SMS) [10-digit phone number]@mms.uscc.net (MMS) Verizon [10-digit phone number]@vtext.com [10-digit phone number]@vzwpix.com (MMS) Virgin Mobile USA [10-digit phone number]@vmobl.com

split large video file
i have a large video file, 500+ MB, so i cant upload it to flickr, so to reduce the size i split it into 2 files. the command shows the splitting for the first file, from 0-4 minutes. ss is start time and t is duration (how long you want the output file to be). credit goes to philc: http://ubuntuforums.org/showthread.php?t=480343 NOTE: when i made the second half of the video, i got a *lot* of lines like this: frame= 0 fps= 0 q=0.0 size= 0kB time=10000000000.00 bitrate= 0.0kbit just be patient, it is working =)

Use curl with a local SOCKS5 proxy (e.g. Tor)
Routes curl input through a local SOCKS5 proxy; in this case, anonymizes curl activity via The Onion Router (Tor) proxy running locally. Note that the traffic will be anonymized, but it will NOT be encrypted, so your traffic will be very vulnerable to man-in-the-middle attacks.

list block devices
Shows all block devices in a tree with descruptions of what they are.

Open (in vim) all modified files in a git repository
The option --porcelain makes the output of git easier to parse. This one-liner may not work if there is a space in the modified file name.


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: