Sponsored Content
Top Forums UNIX for Dummies Questions & Answers append following lines to 1st line, every 3 lines Post 302665533 by MaindotC on Monday 2nd of July 2012 08:42:04 PM
Old 07-02-2012
append following lines to 1st line, every 3 lines

I have output like this:
Code:
USER_ID
12/31/69 19:00:00
12/31/69 19:00:00
USER_ID
12/31/69 19:00:00
12/31/69 19:00:00
USER_ID
12/31/69 19:00:00
12/31/69 19:00:00
USER_ID
12/31/69 19:00:00
12/31/69 19:00:00
...

where USER_ID is a unique user login followed by their login timestamp and logout timestamp. How can I append the login and logout timestamps to the end of the user_id line? It would look like this:
Code:
USER_ID 12/31/69 19:00:00 12/31/69 19:00:00

I've been experimenting with this from the sed one-liners:
Quote:
Originally Posted by http://sed.sourceforge.net/sed1line.txt
# if a line ends with a backslash, append the next line to it
sed -e :a -e '/\\$/N; s/\\\n//; ta'
using this:
Code:
sed -e :a -e '/:[0-9][0-9]$/N; s/[0-9][0-9]$\n//; ta'

but it's producing:
Code:
USER_ID
12/31/69 19:00:12/31/69 19:00:USER_ID
12/31/69 19:00:12/31/69 19:00:USER_ID
12/31/69 19:00:12/31/69 19:00:USER_ID
12/31/69 19:00:12/31/69 19:00:USER_ID

Can someone advise?
 

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
AQHBCI-TOOL4(1) 														   AQHBCI-TOOL4(1)

NAME
aqhbci-tool4 - Command line tools for setup, modification and debugging of HBCI settings. SYNOPSIS
aqhbci-tool4 [global options] <command> [command options] DESCRIPTION
The aqhbci-tool4(1) command can be used to setup and manage AqBanking's HBCI users, customers and accounts. OPTIONS
Two common options need to be distinguished carefully from each other: "-c CUSTOMER_ID" refers to the German "Kunden-ID" or "Kundennummer". "-u USER_ID" refers to the German "Benutzerkennung". If your bank has specified both to you, you need to check carefully not to confuse one with the other. -C PARAM, --cfgfile=PARAM Specify the configuration file -P PARAM, --pinfile=PARAM Specify the PIN file -n, --noninteractive Select non-interactive mode. This automatically returns a confirmative answer to any non-critical message. -A, --acceptvalidcerts Automatically accept all valid TLS certificate --charset=PARAM Specify the output character set -h, --help Show this help screen. For help on commands, run aqhbci-tool <COMMAND> --help. COMMANDS
mkpinlist This command creates an empty PIN file adduser Adds a user (-> setup HBCI for a bank) deluser Deletes a user. getkeys Requests the server's key getcert Requests the server's SSL certificate createkeys Create user keys. sendkeys Send the user keys to the bank. getaccounts Requests account list for a user getsysid Requests a system id for the given user getitanmodes Requests supported iTAN modes for the given user listusers List the users listaccounts List the accounts changepin Change the PIN of a key file iniletter Print the INI letter for a given user addaccount Manually add account delaccount Deletes account setMaxTransfers Set the maximum number of transfers/debit notes per job setTanMediumId Set the medium id for some PIN/TAN methods (like mTAN) For help on options available to specific commands, run aqhbci-tool4 <COMMAND> --help. FILES
$HOME/.aqbanking/ All files in this directory are part of the AqBanking configuration. Even though mostly all files are in a simple plaintext syntax, you MUST NOT change anything in here without using the tools or libraries provided by AqBanking, except you know exactly what you are doing. Those files may be subject to changes in future AqBanking releases. BUGS
Probably lots, please post them to the mailing list (see Resources below) when you find them. RESOURCES
The README file[1] contains the README which describes some setup scenarios in detail. On the AqBanking mailing lists[2] you can give kudos to the developers or get answered your questions. COPYING
Copyright (C) Martin PreuB. Free use of this software is granted under the terms of the GNU General Public License (GPL). The manpage was composed by Micha Lenk and converted by the nifty tool AsciiDoc into a manpage. AUTHOR
Micha Lenk <micha@lenk.info> Author. NOTES
1. The README file file:///usr/share/doc/aqbanking-tools/README.aqhbci-tool.gz 2. AqBanking mailing lists http://lists.aqbanking.de/cgi-bin/mailman/listinfo/aqbanking-user 12/09/2012 AQHBCI-TOOL4(1)
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy