This is a repository of all of my Linux/Unix writings as well as useful tips and tricks for systems administration, engineering, and programming.
how do i copy first three lines of a file and append it to end of the fileeg i have a file eg.txtline1line2line3line4i want the output to beline1line2line3line4line1line2line3
$ echo -e "line1\nline2\nline3\nline4" > eg.txt$ cat eg.txtline1line2line3line4$ echo -e "line1\nline2\nline3" >> eg.txt$ cat eg.txtline1line2line3line4line1line2line3
Post a Comment
2 comments:
how do i copy first three lines of a file and append it to end of the file
eg i have a file eg.txt
line1
line2
line3
line4
i want the output to be
line1
line2
line3
line4
line1
line2
line3
$ echo -e "line1\nline2\nline3\nline4" > eg.txt
$ cat eg.txt
line1
line2
line3
line4
$ echo -e "line1\nline2\nline3" >> eg.txt
$ cat eg.txt
line1
line2
line3
line4
line1
line2
line3
Post a Comment