I have a .csv file that is tab delimited and I need to move the header row information to a new column at the beginning and a specified numbers of rows down. I would like to use standard tools that I currently use such as sed or awk but if another tool/method is more appropriate I would welcome the suggestion. The header changes per file, that's why I need to copy it instead of just placing the string CAT in the appropriate row and column.                            CAT    DOG     DOG     DOG     DOG     DOG     DOG     DOG    DOG     DOG     DOG     DOG     DOG     DOG     DOG    DOG     DOG     DOG     DOG     DOG     DOG     DOG    DOG     DOG     DOG     DOG     DOG     DOG     DOGWould become:                            CAT            DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOG    CAT     DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOG
Use SED or AWK to move string to new column and row
text processing;awk;sed
paste can also make it:editedThis prints the first line again. Taking advantage of the lack of quotes, the trailing spaces are not showing:$ paste -d\t <(printf \n\n\n%s $(head -1 file)) file                                    CAT            DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOGCAT         DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOGoriginal$ -d\t <(printf \n\n\nCAT) file                                    CAT            DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOGCAT         DOG     DOG     DOG     DOG     DOG     DOG     DOG            DOG     DOG     DOG     DOG     DOG     DOG     DOG