Category Archives: unix

Bulk file copy in unix with custom name

In Unix I have to copy bulk files from one folder to another they are in below form FILE1_547804_550484_2013-12-19 21.15.32_913.pdfFILE2_518868_616944_2014-01-03 21.10.49_718.pdf but while copying to the destination want to remove time part and copy as below: FILE1_547804_550484.pdfFILE2_518868_616944.pdf

Posted in unix | Tagged , , | Leave a comment

Copy First N files from current directory to other directory

I was working today on one production issue where a requirement came to restore files from a archive directory in batch of 250, so i created this command to run in unix, have a look might be helpful for you.

Posted in unix | Tagged , | Leave a comment

Download sequence of files using Curl

In day to day life we used to download useful stuff from world wide web, sometime requirement to download sequence of files, one way is to do it manually by clicking individual links or automate the download using Curl. Showing … Continue reading

Posted in unix | Tagged | Leave a comment

UNIX: How to Automate SSH Login

Yesterday, I was working on some shell script piece for my project and I came across a situation where I have to copy some files from one server to another using ‘scp’ command and also some time have to execute … Continue reading

Posted in HowTo, linux, unix | Tagged , | Leave a comment

Count lines of multiple similar files in unix

In continuation to my earlier post regarding concatenation similar files into one. I am writing this post to demonstrate counting lines of similar kind of files in a given directory and sub-directory. Below command will find all the logs with … Continue reading

Posted in HowTo, unix | Tagged , , , | Leave a comment

Java Return Value to Unix Shell Script

Today I faced a situation where I need to verify something though Java class in database . My problem was I have to do this inside unix shell script. I created the below solution to achieve that, I am posting … Continue reading

Posted in HowTo, Java, unix | Leave a comment

How to send an email from UNIX using mailx.

#!/bin/sh # # Purpose: Demonstrate how to send an email from UNIX using mailx. ############################################################ # Example 1 – Simple: echo “This is the body.”| mailx -s “mailx Test1” sample@sample.com # Example 2 – Using Variables: SUBJECT=”mailx Test2″ EMAIL_ADDRESS=”sample@sample.com“ BODY=”This … Continue reading

Posted in HowTo, unix | Leave a comment

Delete .svn directories recursively

I am here showing an example of a unix command, which recursively deletes subversion .svn folders. Subversion is a widely used open-source revision control application. Every copy of source code received from subversion repository has .svn folders, which store metadata. … Continue reading

Posted in HowTo, unix | Leave a comment