`grep --line-number -C9`: no padding option? It moves lines when one and two digits results presented - grep

I am getting result like:
file-7- xxxxxxxx
file-8- xxxxxxxx
file-9- xxxxxxxx
file-10- xxxxxxxx
But I want, for example:
file -7- xxxxxxxx
file -8- xxxxxxxx
file -9- xxxxxxxx
file-10- xxxxxxxx

Related

Funny result with multiple backup tape

I'm testing for lto6 tar encrypted backup
I'm using one G only for the test
tar cMpf - --tape-length=1G --blocking-factor 4096 -X /etc/file.exclude /| openssl enc -e -aes256 -salt -pass file:unixpass -out /dev/st0
The first tape work fine
Ask me for second..I insert press return and...
display content of a file!
"<custom_item>type : SQL_POLICYdescription : "2.11 sqlnet.ora settings - 'Setting for the remote_os_authent parameter'""....
this for thousand of lines,like cat command
Using a file for testing it cat /opt/nessus...
opt/nessus/var/nessus/audits/audit_warehouse.audit01402604000014563
Solution found: must insert tape name,i though was automatic generated

How to store server_key_rsa in docker-compose.yml?

I need to store the server_key_rsa of my sftpServer in a docker-compose.yml but I don't know how to store it
It's look like that for now :
-----BEGIN RSA PRIVATE KEY-----
***********************My Key bla bla bla.......
**********************************************
**********************************************
**********************************************
**********************************************
-----END RSA PRIVATE KEY-----
And I would like to store it like that:
server_key_rsa = Here should be the key.
I tried with "|" just before my key, I tried to change my key file to Base64, I tried "\n" between lines, I tried "the\nrsa\nkey", but those solutions failed..
Any idea please ?
The secrets definition in the docker-compose.yml file, as of version 3.3 of the file format, does not support passing the content of the secret inside the docker-compose.yml file itself. The secret needs to be either external (predefined with docker secret create secret_name -) or from the contents of a separate file.
The syntax with an externally defined secret is:
secrets:
my_first_secret:
file: ./secret_data
my_second_secret:
external: true
And the syntax for a separate file containing your secret is:
secrets:
my_first_secret:
file: ./secret_data
my_second_secret:
external:
name: redis_secret

travis encrypt-file for maven deploy

On my computer:
travis login --org
Username: xxxxxx
Password: xxxxxx
Successfully logged in as xxxxxx!
travis encrypt-file codesigning.asc -r XXXXXX/XXXXXX
encrypting codesigning.asc for XXXXXX/XXXXXX
storing result as codesigning.asc.enc
storing secure env variables for decryption
Please add the following to your build script (before_install stage in your .travis.yml, for instance):
openssl aes-256-cbc -K $encrypted_abcd1234_key -iv $encrypted_abcd1234_iv -in codesigning.asc.enc -out codesigning.asc -d
Pro Tip: You can add it automatically by running with --add.
Make sure to add codesigning.asc.enc to the git repository.
Make sure not to add codesigning.asc to the git repository.
Commit all changes to your .travis.yml.
On my travis acount:
On my GitHub repository:
I paste the codesigning.asc.enc file in the test folder test/codesigning.asc.enc.
I add this shell script:
if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then
echo "******** Starting gpg"
openssl aes-256-cbc -K "$encrypted_abcd1234_key" -iv "$encrypted_abcd1234_iv" -in test/codesigning.asc.enc -out test/codesigning.asc -d
gpg --fast-import test/codesigning.asc
fi
I have this error on my travis console:
bad decrypt
139864985556640:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:539:
gpg: invalid radix64 character FE skipped
gpg: invalid radix64 character C4 skipped
gpg: read_block: read error: invalid packet
gpg: import from `test/codesigning.asc' failed: invalid keyring
gpg: Total number processed: 0
OpenPGP (the cryptographic protocol implemented by gpg) and X.509 (the cryptographic protocol used by OpenSSL) are not compatible. You cannot import this key to GnuPG (you could to gpgsm which implements X.509, but this is not the normal gpg you want to use). You will have to stick with OpenSSL or GnuTLS to handle the key and encrypted messages for it.

email contents parsing get email address on shell script

in folder
asdasdasd.msg
asdasd.msg
twadasf.msg
...
...
...
*.msg file Sample Email Contents =>
Date: Wed, 03 Aug 2011 11:20:59 +0300 (EEST)
From: Email Account Name =?utf-8?B?R8OcTkRPxJ5EVQ==?= <emailname#sample.com>
To: Different Email Account Name <different#sample.com>
Subject: Re: Web Anketi
Message-ID: <d6d75689-bfde-451d-8a91-0da4d4e8921e#posta.sample.com>
In-Reply-To: <4ac9813a-4511-4530-b098-62fd23ecdb5b#posta.sample.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Originating-IP: [10.199.16.77]
....
run.sh script:
for line in `sed 's/\(<\)\(.*\)\(#sample.com>\)/\2/'` *.msg
do
echo $line
done
*my problem is getting email address List *#sample.com?
get all email address array list?*
Using a bash for loop to read all *.msg files. sed -n suppresses output of all non-matches for the pattern. The p flag at end of the sed command prints out the substituted text.
for file in *.msg
do
sed -n 's/^.*\(<\)\(.*\)\(#posta.sample.com>\)/\2/p' $file
done
thanks man :)
is worked code
for file in *.msg
do
sed -n 's/^.*\(<\)\(.*\)\(#posta.sample.com>\)/\2/p' $file
done
how to result to define ArrayList variables ?

How to parse text file and retrieve only selected text?

In my log file I have the text in the following format:
18 Mar 2001 14:18:17,438 INFO DomainName1\EmpId1#Admin#3.1
18 Mar 2001 14:19:00,872 INFO DomainName2\EmpId2#User#1.3.2.0
18 Mar 2001 14:20:05,418 INFO DomainName3\EmpId3#Admin#4.3.1.0
I just want to get only the EmpId's.
What about something like
cat logfile | cut -d '#' -f 1 | cut -d '\' -f 2
(This assumes that you are on a Unix-like system, and also assumes that '#' and '\' won't pop up elsewhere than where you put them in your example.)

Resources