07-20-2010
How to combine lines?
Hi,
I have a file like this:
"sdfc@abc.com","arovls","some addr
", "more stuff"
"ssss@email.com","arovls","some addr", "sss"
"edx@email.com","arovls","some addr", "sssdfvv"
"ssss@a55.com","arovls","some addr", "lsdsdgf"
"ssss@0234.com","aro
vls","123
Main", "lSdfv"
I want to combine lines if the first field in the record is an email address and the start of the succeeding lines is not an email address.
For Example, I want the above output to be:
"sdfc@abc.com","arovls","some addr", "more stuff"
"ssss@email.com","arovls","some addr", "sss"
"edx@email.com","arovls","some addr", "sssdfvv"
"ssss@a55.com","arovls","some addr", "lsdsdgf"
"ssss@0234.com","arovls","123 Main", "lSdfv"
Thanks in advance for your help!
Ernie
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I have a file called test.txt. Inside this file is the following:
tcenh100.telkom.co.za
100.200.300.400
tcenh101.telkom.co.za
500.600.700.800
I want to take out the new lines and spaces, then I want to put the ip address of the host name next to the host name on the same line, as soon as... (7 Replies)
Discussion started by: wolf
7 Replies
2. UNIX for Dummies Questions & Answers
Hi
I have a file with the records
1 A B C D
2 E F G H
3 I J K L
4 M N O P
In the ouput I want
1 A B C D 2 # F G H
3 I J K L 4 M N O P
How to achieve this? (10 Replies)
Discussion started by: superprg
10 Replies
3. Shell Programming and Scripting
Moderator, kindly delete this thread because I already found what I needed... thanks. (0 Replies)
Discussion started by: Deanne
0 Replies
4. UNIX for Dummies Questions & Answers
I tried to put the history line number and the date into the file with one command, and failed. Can't figure out how to get the date variable substituted for the last space captured.
history | tail -1 | sed -e 's/.\{7\}/&/g' | head -1 | sed 's/ $/$date/'
Result was:
729 $date
So, I... (8 Replies)
Discussion started by: jimbob75
8 Replies
5. Shell Programming and Scripting
Hello,
I want to combine 2 lines in one
I have a text file
example:
bla123 blo31 xx:yy:zz
->bla43 bli532 00:01:02
bla1237 blo351 aa:ss:dd
->bla433 bli34332 55:10:28
I want the result to be:
bla123 blo31 xx:yy:zz, ->bla43 bli532 00:01:02
bla1237 blo351 aa:ss:dd, ->bla433 bli34332... (3 Replies)
Discussion started by: Petko Meshov
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a file like this:
A 1
B 2
C 3
...
And I want to have just one line like this:
A 1 B 2 C 3 ...
How can I do it?
Thanks! (4 Replies)
Discussion started by: elsagarcia
4 Replies
7. Shell Programming and Scripting
All,
i am new to linux script...
source
Filter: vlan281-BUM-5M
BUM-5M 0 0
Filter: vlan282-BUM-5M
BUM-5M 0 0
Filter: vlan2828-BUM-5M
Filter:... (2 Replies)
Discussion started by: samoptimus
2 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
I am trying to understand if its possible to carry out the following.
I have a text file which contains output from multiple commands, within the file a node will be quiered twice if there was 2 commands for example. Is it possible do combine 2 lines into 1 if the first word is the... (1 Reply)
Discussion started by: mutley2202
1 Replies
9. Shell Programming and Scripting
In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword
SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a.
If it does have that... (12 Replies)
Discussion started by: cmccabe
12 Replies
10. Shell Programming and Scripting
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
LEARN ABOUT DEBIAN
ssss-combine
ssss(1) General Commands Manual ssss(1)
NAME
ssss - Split and Combine Secrets using Shamir's Secret Sharing Scheme.
SYNOPSIS
ssss-split -t threshold -n shares [-w token] [-s level] [-x] [-q] [-Q] [-D] [-v]
ssss-combine -t threshold [-x] [-q] [-Q] [-D] [-v]
DESCRIPTION
ssss is an implementation of Shamir's Secret Sharing Scheme. The program suite does both: the generation of shares for a known secret, and
the reconstruction of a secret using user-provided shares.
COMMANDS
ssss-split: prompt the user for a secret and generate a set of corresponding shares.
ssss-combine: read in a set of shares and reconstruct the secret.
OPTIONS
-t threshold
Specify the number of shares necessary to reconstruct the secret.
-n shares
Specify the number of shares to be generated.
-w token
Text token to name shares in order to avoid confusion in case one utilizes secret sharing to protect several independent secrets.
The generated shares are prefixed by these tokens.
-s level
Enforce the scheme's security level (in bits). This option implies an upper bound for the length of the shared secret (shorter
secrets are padded). Only multiples of 8 in the range from 8 to 1024 are allowed. If this option is ommitted (or the value given is
0) the security level is chosen automatically depending on the secret's length. The security level directly determines the length of
the shares.
-x Hex mode: use hexadecimal digits in place of ASCII characters for I/O. This is useful if one wants to protect binary data, like
block cipher keys.
-q Quiet mode: disable all unnecessary output. Useful in scripts.
-Q Extra quiet mode: like -q, but also suppress warnings.
-D Disable the diffusion layer added in version 0.2. This option is needed when shares are combined that where generated with ssss ver-
sion 0.1.
-v Print version information.
EXAMPLE
In case you want to protect your login password with a set of ten shares in such a way that any three of them can reconstruct the password,
you simply run the command
ssss-split -t 3 -n 10 -w passwd
To reconstruct the password pass three of the generated shares (in any order) to
ssss-combine -t 3
NOTES
To protect a secret larger than 1024 bits a hybrid technique has to be applied: encrypt the secret with a block cipher and apply secret
sharing to just the key. Among others openssl and gpg can do the encryption part:
openssl bf -e < file.plain > file.encrypted
gpg -c < file.plain > file.encrypted
SECURITY
ssss tries to lock its virtual address space into RAM for privacy reasons. But this may fail for two reasons: either the current uid
doesn't permit page locking, or the RLIMIT_MEMLOCK is set too low. After printing a warning message ssss will run even without obtaining
the desired mlock.
AUTHOR
This software (v0.5) was written in 2006 by B. Poettering (ssss AT point-at-infinity.org). Find the newest version of ssss on the project's
homepage: http://point-at-infinity.org/ssss/.
FURTHER READING
http://en.wikipedia.org/wiki/Secret_sharing
Manuals User ssss(1)