Your Only Destination To Empower Your Computer Programing Knowledge. Sky is not so high, You can Touch it if You Try

Script showing the use of head,tail and more command

echo Enter file name
read a
echo
echo Contents of file are:-
cat $a
echo
echo Showing first 12 lines from given file
head -12 $a
echo
echo Showing last 15 lines from given file
tail -15 $a
echo
echo Showing contents within the range 10-15
more +10 -5 -d $a

~
~
~
"head" 11L, 263C


Output:-

Enter file name
Jannat

Contents of file are:-
Tit for tat.
Do good have good
radhe radhe
Saini sir test le rhe h\
Never forget god and your aim.
Sab ka malik ek h
jindgi ek safar h suhana.
jeena kya jeevan se har ke.
chhodo kal ki baten kal ki bat purani aaj hm likhenge unix ki nyi kahani.
go to hell.
Jai shree krishna.
tyari kr lo bacho exam postpone nhi huye.
syllabus bhut jyada h.
lets do one night fight.
khalo kha lo hmare bhi din aayenge.
Necessity is mother of invention.
Prevention is better than cure.
jai mata di.
life is a race.
slow and steady wins the race.
rain is coming.
jitin party de rha h .
Aman mam chle gye.

Showing first 12 lines from given file
Tit for tat.
Do good have good
radhe radhe
Saini sir test le rhe h\
Never forget god and your aim.
Sab ka malik ek h
jindgi ek safar h suhana.
jeena kya jeevan se har ke.
chhodo kal ki baten kal ki bat purani aaj hm likhenge unix ki nyi kahani.
go to hell.
Jai shree krishna.
tyari kr lo bacho exam postpone nhi huye.
Showing last 15 lines from given file
chhodo kal ki baten kal ki bat purani aaj hm likhenge unix ki nyi kahani.
go to hell.
Jai shree krishna.
tyari kr lo bacho exam postpone nhi huye.
syllabus bhut jyada h.
lets do one night fight.
khalo kha lo hmare bhi din aayenge.
Necessity is mother of invention.
Prevention is better than cure.
jai mata di.
life is a race.
slow and steady wins the race.
rain is coming.
jitin party de rha h .
Aman mam chle gye.

Showing contents within the range 10-15
go to hell.
Jai shree krishna.
tyari kr lo bacho exam postpone nhi huye.
syllabus bhut jyada h.
lets do one night fight.
--More--(62%)[Press space to continue,'q' to quit.]

No comments:

Post a Comment