User:Apangshusaha/Apangshu's Scripting Languages

Perl
Perl-1

Sample Unix shell Scripts
1> This Example shows the use of sorting and joining contents from two different files

\rm -rf browser-sorted.tx contents-sorted.txt

sort +1 -2 browser.txt > browser-sorted.txt

sort -n contents.txt > contents-sorted.txt

cut -d " " -f 2 browser-sorted.txt > temp-1

cut -d "|" -f 1 contents-sorted.txt > temp-2

pr -tm temp-1 temp-2 | awk '{print $1" "$2}'

\rm -rf temp-1 temp-2

GO_AHEAD_CHOICE="1"

echo "Please enter your choice(1: Go Ahead 2:Exit) >> "

read CHOICE

if [ "$CHOICE" -eq "$GO_AHEAD_CHOICE" ]; then

\rm -rf join-file1.txt join-file2.txt

cut -d " " -f 1 browser-sorted.txt > join-file1.txt

cut -d "|" -f 2 contents-sorted.txt > join-file2.txt

pr -tm join-file1.txt join-file2.txt | awk '{print $1" "$2}' > ContentCadNames.txt

rm -rf browser-sorted.txt contents-sorted.txt join-file1.txt join-file2.txt

else

echo "EXITING.....!"

fi

Back to -> Home
Back to -> Home