user2536319
user2536319

Reputation: 39

Copy the data from one file to another

I have text BGP RIP file and its in GBs and i am not able to open in my system and i need to analyze the different parameters such as IP and its pool .

Is there any command that i can save initial logs into another file.

such like

head -5 routes

which will display the initial 5 lines but i like to save that lines in to another file.

I tried this also

head -5 routes -> newfile

but not work

Upvotes: 0

Views: 866

Answers (3)

Yu Hao
Yu Hao

Reputation: 122383

Just for completeness,

head -5 routes > newfile

will redirect standard output to newfile, newfile will be overwritten.

head -5 routes >> newfile

will redirect standard output to append to newfile, i.e, the previous content of newfile will still be there, new content will be appended.

Upvotes: 1

Doon
Doon

Reputation: 20232

Also take a look at the split command. It can break the file up into multiple smaller files for you.

Upvotes: 0

Barmar
Barmar

Reputation: 781058

The correct syntax to redirect output is:

head -5 routes > newfile

This should be in every Unix shell tutorial.

Upvotes: 0

Related Questions