Any easy way to take 2, maybe 3 text files and interlace them into a single file?
So line 1 from file 1 is line 1.
line 1 from file 2 is line 2.
line 2 from file 1 is line 3.
or line 1 from file 3 is line 3.
and so on, each file 80-90 lines, so I quickly loose focus!
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
How to interlace text files? [Solved]
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
-
- Global Moderator
- Posts: 2715
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: How to interlace text files?
Thank you! Close, but no cigar.
It won't alternate lines. I expected "-d '/n'" to do it, the result is line1file1/line1file2 on one line.
However "-d '#'" is close to my desired with line1file1#line1file2(#line1file3) on one line, and this result is usable.
That's safe and makes my manual edit easier. It seems a lost cause to avoid a manual edit since any logic I inject is foiled by 'stupid'.
I'm parsing dvb scan files and each line contains important info and 'text' that is entered by various employees of varied intelligence, for which parsing is impossible. I need to manually clean it no matter what.
Problem #2 is the files order is based on frequency and that relation changes too, meaning I need to move blocks of info, with no pre-logic I can think of possible since each change would be unique.
If anybody has had a particular TV not receive all channels I might be able to tell you why!
Maybe this useful naming!
Or overlapping affiliates (I have a really good antenna!)
Or total ambiguity
Those errors barf on some devices. I can correct them, but maybe not automagically...
It won't alternate lines. I expected "-d '/n'" to do it, the result is line1file1/line1file2 on one line.
However "-d '#'" is close to my desired with line1file1#line1file2(#line1file3) on one line, and this result is usable.
That's safe and makes my manual edit easier. It seems a lost cause to avoid a manual edit since any logic I inject is foiled by 'stupid'.
I'm parsing dvb scan files and each line contains important info and 'text' that is entered by various employees of varied intelligence, for which parsing is impossible. I need to manually clean it no matter what.
Problem #2 is the files order is based on frequency and that relation changes too, meaning I need to move blocks of info, with no pre-logic I can think of possible since each change would be unique.
If anybody has had a particular TV not receive all channels I might be able to tell you why!
Maybe this useful naming!
Code: Select all
Presented by KCEC:581000000:8VSB:65:68:2
Presented by KCEC:581000000:8VSB:81:84:3
Presented by KCEC:581000000:8VSB:97:100:4
Code: Select all
MYS:177000000:8VSB:65:68:4
Laff:177000000:8VSB:81:84:5
......
MYS:569000000:8VSB:65:68:4
Laff:569000000:8VSB:81:84:5
Code: Select all
[0002]:479000000:8VSB:65:68:2
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: How to interlace text files?
Try a backslash instead:CwF wrote:It won't alternate lines. I expected "-d '/n'" to do it
Code: Select all
~$ cat test{1,2}
1
2
3
4
5
one
two
three
four
five
~$ paste -d '\n' test{1,2}
1
one
2
two
3
three
4
four
5
five
~$
deadbang
- sunrat
- Administrator
- Posts: 6497
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 118 times
- Been thanked: 476 times
Re: How to interlace text files? [Solved]
That's really neat! Of course I'll never remember it if I ever need it, and if I write it down it will guarantee I never need it!
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!