Paste clipboard is bash or shell scripts with modification.

2010-07-20 1 min read bash Linux
Today I had a issue where I wanted to paste the clipboard to a shell script after removing the spaces. So, I went hunting for a way to do this. Finally I came up with this: sudo yum install xclip Then you can paste the clipboard content using ”xclip -o”. So now the problem is reduced to selecting the required info and doing : xclip -o |sed ’s/ //g’ Continue reading

CLI Color and bash prompt.. some colored fun with prompts in bash

2010-06-29 5 min read bash Fedora Linux
There are two ways to do it, one is with tput command. We will see that some other time, today we will consider the escape sequence way. First we need to understand the colors as understood by bash. Some time back a fried of mine gave me this little script to find the colors. You can download it <a href="http://blog.amit-agarwal.co.in/2009/03/bash_colors" target="_blank">Script bash colors. Here is the script #!/bin/bash T=&#8217;amit agarwal&#8217; # The test text Continue reading

Getting your wordpress self hosted stats on your console with bash script.

2010-06-29 3 min read bash Learning
Some time back I wrote a blog on how to get your site stats using curl in <a class="zem_slink freebase/en/bash" title="Bash" rel="homepage" href="http://tiswww.case.edu/php/chet/bash/bashtop.html">bash shell. Today we will use the same script to get the stats every few seconds on the terminal on the same line, similar to progress meter. Here is the script and the description: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Continue reading

Magic space on the current command line

2010-06-25 1 min read bash Fedora Linux
# For how to set up magic space for Bash see: # – http://www.ukuug.org/events/linux2003/papers/bash_tips/#slide15 # – http://codesnippets.joyent.com/posts/show/1690 man bash 2>/dev/null | less -p &#8217;magic-space&#8217; man bash 2>/dev/null | less -p &#8217;Event Designators&#8217; man bash 2>/dev/null | less -p &#8217;\!#&#8217; # &#8221;The entire <a class="zem_slink" title="Command-line interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Command-line_interface">command line typed so far.&#8221; <a href="http://snippets.dzone.com/posts/show/10265">Read more :<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.makeuseof.com/tag/trigger-wake-lan-mac-address/">How To Trigger Wake On LAN Using The MAC Address (makeuseof. Continue reading

bash one liner to change/remove test pattern from config file or text file.

2010-06-25 1 min read bash Fedora Learning Linux
Problem: I had a directory with a lot of config files in the ini file format, i.e. name and value separated by equals. Some/all of these contained some directory names and other values which had to be replaced. But there were other place where I should not not replace them, if there was no exact match. I also needed to have a backup copy of the file that I was modifying. Continue reading

find duplicate entry in a list in bash with sed

2010-06-25 1 min read bash Fedora Learning
Here I will take an example of rss2email list, but I guess I will be able to pass on the concept. Here is example of the output of the r2e list command: 1: http://blog.amit-agarwal.co.in/feed (default: amitag@localhost) 2: http://feeds2.feedburner.com/AllAboutLinux (default: amitag@localhost) 3: http://feeds2.feedburner.com/Command-line-fu (default: amitag@localhost) 4: http://blogs.members.freewebs.com/Members/Blogs/viewBlogRSS.jsp?userid=29731143 (default: amitag@localhost) Target here is to get the list of all duplicate entries if any. So, first we need to remove the numbers from the begining and the email ID from the end. Continue reading
Older posts Newer posts