Copy from file1 to file2 - Trying sed
I'm learning to program in an environment without a GUI. During the course of my programming, I've found more and more that it would be better from an organization standpoint to move certain things from one file to another. At first, it was simple one or two line stuff that I could manually type out. Now, however, I'm trying to copy 78 lines of code, and that's just not going to work by hand. So I'm trying to use sed to do it for me. Right now, here's my code:
Code:
sed '1,78 p' file1 > file2 If there's a better way to copy only lines 1 through 78 from file1 to file2, I'd be interested in hearing it. Thanks! |
SED prints everything unless told otherwise. In your example, it prints lines 1 thru 78 twice.
How about: sed '79,$ d' file1 > file2 SED tutorial here: http://www.grymoire.com/Unix/Sed.html |
Thanks, Pixellany. :)
i was able to accomplish everything I needed between your advice and that tutorial! |
Quote:
Code:
sed -n '5p' Regards, Pute. |
All times are GMT -5. The time now is 11:54 PM. |