I am trying to create a new file (say file3) by stacking two files (file1 and file2) together. I need the entirety of file1 but want to exclude the first row of file2. What I have now is a two step process using head and sed.
cat file1.csv file2.csv > file3.csv
sed -i 1001d file3.csv
The last step requires me to find out the length of file1 before removing the line after so that it corresponds to the first line of file2. How do I combine these two lines into a single line of code? I tried this and it failed:
cat file1.csv sed 1d file2.csv > file3.csv
                You can use a compound statement like this:
{ cat file1.csv; sed '1d' file2.csv; } > file3.csv
                        You can use process substitution, like:
cat file1.csv <(tail -n +2 file2.csv) > file3.csv
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With