Sponsored Content
Top Forums UNIX for Dummies Questions & Answers append following lines to 1st line, every 3 lines Post 302667629 by ctsgnb on Friday 6th of July 2012 02:39:58 PM
Old 07-06-2012
You can also specify a delimiter (here, a space) with the paste alternative (to avoid the tabs that are used by default):

Code:
paste -d" " - - - <yourfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Joining lines in reverse. append line 1 to line 2.

Hi I have used many times the various methods to append two lines together in a file. This time I want to append the 1st line to the second and repeat for the complete file.... an example This is the file owns the big brown dog joe owns the small black dog jim What I want is ... (7 Replies)
Discussion started by: dwalley
7 Replies

2. Shell Programming and Scripting

Append specific lines to a previous line based on sequential search criteria

I'll try explain this as best I can. Let me know if it is not clear. I have large text files that contain data as such: 143593502 09-08-20 09:02:13 xxxxxxxxxxx xxxxxxxxxxx 09-08-20 09:02:11 N line 1 test line 2 test line 3 test 143593503 09-08-20 09:02:13... (3 Replies)
Discussion started by: jesse
3 Replies

3. Shell Programming and Scripting

Append text to end of line on all lines

Hi, I've spent some time researching for this but can't seem to find a solution. I have a file like this 1234|Test|20101111|18:00|19:00There will be multiple lines in the file with the same kind of format. For every line I need to make it this 1234|Test|20101111|18:00|19:00||create... (5 Replies)
Discussion started by: giles.cardew
5 Replies

4. Shell Programming and Scripting

need to delete all lines from a group of files except the 1st 2 lines

Hello, I have a group of text files with many lines in each file. I need to delete all the lines in each and only leave 2 lines in each file. (3 Replies)
Discussion started by: script_op2a
3 Replies

5. UNIX for Dummies Questions & Answers

Get only the 1st and 8th line from every 10 lines

Hi, I have 1000 line text file. I need only the 1st and 8th line from every set of 10 lines, that is, 1,8,11,18,21,21,28,31,38,... lines etc into a text file. Please let me know how I can achieve the same. Regards, Don (2 Replies)
Discussion started by: donisback
2 Replies

6. Shell Programming and Scripting

how to append multiple lines to the last line of a file

Hello, This is what I am trying to achieve: file1 a b c d file2 e f g h (8 Replies)
Discussion started by: smarones
8 Replies

7. UNIX for Dummies Questions & Answers

Removing the lines which are same as 1st line

Hi, My file has the below content Heading 1 2 3 Heading 4 5 6 I need to remove the other occurrences of first line and display other lines. The content of first line is not static My output should be: Heading 1 2 (8 Replies)
Discussion started by: pandeesh
8 Replies

8. Shell Programming and Scripting

Append next line to previous lines when NF is less than 0

Hi All, This is very urgent, I've a data file with 1.7 millions rows in the file and the delimiter is cedilla and I need to format the data in such a way that if the NF in the next row is less than 1, it will append that value to previous line. Any help will be appricated. Thanks,... (17 Replies)
Discussion started by: cumeh1624
17 Replies

9. Shell Programming and Scripting

awk to remove lines that do not start with digit and combine line or lines

I have been searching and trying to come up with an awk that will perform the following on a converted text file (original is a pdf). 1. Since the first two lines are (begin with) text they are removed 2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
PASTE(1)                                                           User Commands                                                          PASTE(1)

NAME
paste - merge lines of files SYNOPSIS
paste [OPTION]... [FILE]... DESCRIPTION
Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -d, --delimiters=LIST reuse characters from LIST instead of TABs -s, --serial paste one file at a time instead of in parallel -z, --zero-terminated line delimiter is NUL, not newline --help display this help and exit --version output version information and exit AUTHOR
Written by David M. Ihnat and David MacKenzie. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report paste translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/paste> or available locally via: info '(coreutils) paste invocation' GNU coreutils 8.28 January 2018 PASTE(1)
All times are GMT -4. The time now is 11:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy