Hi together,
unfortunately I am not a shell script guru - the following might touch
the depths of awk, substr, split, regexps, where I am still fighting with - but as always the boss needs a fast solution :-(
So: I have the following USER/PASSWORD-installation-config-file, from where I want to read out the BELONGING TOGETHER user/passwords pairs to postprocess them in an sqlplus command to test if those users have already an account on the database:
Conditions here are:
=> always the same in the strings is "access.user=<username>" (resp. "admin.user=<username>")
=> always the same in the strings is also "access.password=<passwort>" (resp. "admin.passwort=<passwort>")
=> for a belonging together pair for example "admin.user/admin.password" the preceding text (for example "text4") is always the same (the same for the accompanying "access user")
=> the exact text-prefixes I don't know at the time of the shell script run (I know only that they are the same for a belonging together pair of user-password; otherwise I could go there with an exaxt grep on the prefix text and split afterwards with awk -F\= .... )
=> of course there could be also more lines than these examples; so I have to search what pairs are belonging together, according to the prefix text, but how :-) ?
=> the lines could also stand disordered
=> So as an OUTPUT FILE I would need only the belonging together
user<blank>password pairs regardless if it is admin or access user, must also not be "ordered" necessarily, but with the belonging together user/password pairs:
For me (still :-) the algorithmic difficulty is, that I don't want to bring mistakenly
for example the "text3.access.user" with the "text1.access.password" together, but the pairs with the same text prefix :-)
Now I hope, that I did not describe my problem to extensive and that it can be understood.
For a quick help I would be very thankful :-)
Thank you both first of all, I really appreciate people here: but the problem I described is a bit harsher here:
- The "text" prefix can contain "." characters also for example: "dsds.fdfdf.sgdsg" and it is definitely like this, so I cannot say the whole string can be divided by three sub-strings separated by "." :-( So I think one has to search explicitly for the patterns for example "admin.user" and compare the text in front to retrieve the correct user/password combination .... Hmm ?
Last edited by fpmurphy; 08-07-2011 at 11:25 AM..
Reason: correct numerous spelling errors
the more complex realistic data sample could be (instaed of the "textx"
aa.bbb.ccc.admin.user=Hans aa.bbb.ccc.admin.password=Dampf aa.bbb.ccc.access.user=Klaus aa.bbb.ccc.access.password=Krampf gggg.hh.zzz.tttt.admin.user=Willi
gggg.hh.zzz.tttt.admin.password=stumpf gggg.hh.zzz.tttt.access.user=heiner gggg.hh.zzz.tttt.access.password=keiner
# and so on: "textx" is a substring with a variable number of substrings
# delimited by ".", but is each the same for the user/password pair
# belonging together
In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
So I'm trying to pass certain json elements as env vars and use them later on in a script.
Sample json:
JSON='{
"Element1": "file-123456",
"Element2": "Name, of, company written in, a very weird way",
"Element3": "path/to/some/file.txt",
}'
(part of the) script:
for s... (5 Replies)
Hi team,
I'm a newbie of Perl Script and looking to create a simple perl script that will run in the Linux system:
1) to find process, such as ps -ef | grep process name
2) to exclude strings from the output if it found, for instance if i see abc from usr process, then will exclude it from... (1 Reply)
Hi all,
I'd like you to help or give any advise about the following:
I have two (2) files, file1 and file2, both files have information common to each other. The contents of file1 is a subset of the contents of file2:
file1:
errormsgadmin
esdp
esgservices
esignipa
iprice
ipvpn
irm... (18 Replies)
Hi all,
I'd like you to help or give any advise about the following:
I have two (2) files, file1 and file2, both files have information common to each other. The contents of file1 is a subset of the contents of file2:
file1:
errormsgadmin
esdp
esgservices
esignipa
iprice
ipvpn
irm... (0 Replies)
Hi ,
I want to write a simple script.
I have two files
file1:
BCSpeciality
Backend
CB
CBAPQualDisp
CBCimsVFTRCK
CBDSNQualDisp
CBDefault
CBDisney
CBFaxMCGen
CBMCGeneral
CBMCQualDisp
file2:
CSpeciality
Backend (8 Replies)
Hello All,
I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'.
Thanks in advance,
Satheesh (5 Replies)
I can do this on the command line:
sqsh -S 192.168.x.x -o tmp -U user -P fakepass -D horizon -C "\
select second_id
from borrower
where btype like '%wsd%'
"
I can also just leave the SQL at the end intact on one line ....
... However, when I throw this in a script like:
$SQSH -o... (4 Replies)
Hello All,
I have 2 files
1 ) source file eg
asasa 1.2.3.4 adfhsdfsdfasdf
zxzxzx 2.3.4.56 dsadasdasdsadasd
kjjkjkjk 30.3.4.5 asdsadsadsadsadsad
vxcvxcvx 1.2.3.4 qwewqewqeqweqwe
2) patern file
1.2.3.4 A
2.3.4.56 B
30.3.4.5 C
I need the source to be changed to
asasa A... (2 Replies)
hi ppl,
I have a basic doubt as to how shell treats strings.
e.g:given a line of data like this "5","6","45","77","89"
extracting the value from each field to a variable will conatin a string("5") or just the number?
If it conatins "5", how do we perform mathematical operations with that... (3 Replies)