what is the easiest way to "knock off" the just the first line of a file in bash.

I have a data file and I fix the first entry and then delete the entry.  

My problem is that I do not really trust sed on solaris boxes.  I assume that if it works in solaris, it will work in linux  ( ksh & bash ).

what is an easy way to get rid of the first line in a file in solaris ( and should also work in linux and hopefully aix  ).

Cross platform is the key

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tail -n +2 file_name
Why wouldn't you trust sed?

sed "1d" filename

wil work on any platform.

With GNU sed (Linux) you can even change the file "in place":

sed -i "1d" filename.

Without GNU sed you'll have to use (preserving permissions):

cp -p filename filename.$$; sed "1d" filename > filename.$$; mv filename.$$ filename; rm filename.$$

awk is always an anlternative, equally available on any platform:

awk 'NR!=1 {print}' filename

To replace the original file:

cp -p filename filename.$$; awk 'NR!=1 {print}' filename > filename.$$; mv filename.$$ filename; rm filename.$$




Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TIMFOX123Author Commented:
Let me see if I understand this.

If I want to use the cross platform script I need to do someting like this for sed ?  

sed "1d" fixes2 > fixes3;  cp fixes3 fixes2  

Seems messy.

If there is a better way I am all ears !!!

TIMFOX123Author Commented:
thank you

it worked

I used sed
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.