I have a string that may or may not have 4 dots.
The string is actualy a file within a folder, where multiple files are located.
Files may look like:
I want to fill 2 variables, $SERVER and $SHARE.
Obviously either '127.0.0.1' or 'servername' should be in $SERVER, while 'sharename' should become $SHARE.
Maybe i could just use another symbol than a dot as filename seperator between $SERVER and $SHARE?
But i nether want to use '-' nor '_' as they might occour in a share- or servername (right?), while i'm not sure how a coma as part of a filename works out.
Please note, the relevant code blocks are the function and the 'else' part.
As of now, within that elseblock, i need to split up $SERVER (127.0.0.1.SHARENAME) and make SHARENAME the $SHARE variable, which is currently empty.
Thank you in advance
Always right after posting an idea pops up
I could just replace the dots with spaces (using sed), and then check how many words there are, and use the last word (like for word in line,do SHARE=$word;done) to be used as Variable $SHARE
No better solution comes to mind.
---------- Post updated at 16:13 ---------- Previous update was at 15:35 ----------
The loop works, though its not elegant, but once all is working, the scripts needs another rewrite anyway.
I wish to remove any word coming after searched string found in a word.
http://www.aa.bb.cc http://www.xx.yy http://www.11.22.44
http://www.11.rr.cd http://www.01.yy http://www.yy.22.tt
http://www.22.qq.fc http://www.0x.yy... (15 Replies)
I try to delete all strings if their first or last word is one of this list of words : "the", "i", "in", "there", "this", "with", "on", "we", "that", "of"
For example if i have this string in an input file "with me" this string will be removed,
"the european... (2 Replies)
Is there a better way to achive this other than cut command?
Basically, I need to remove the 1st word and _ from the string.
Thanks. (1 Reply)
I am running a command find . -name amp.cfg | cut -c 3- which gives me output something like below
deb/err/amp.cfg I want to remove trailing "/amp.cfg" so that i should get output something like... (7 Replies)
I have a file which has the following
I want to do something like this
/u12/data/oracle... (7 Replies)
I have a file in which a number of lines are starting with similar first word but different next words.
I want to replace the any nth word(not 1st or 2nd) with another word.
Eg:- My file contains are like this:-
Ram is a boy.
Ram is a good boy.
Ram plays cricket.
Here I want to... (2 Replies)
family balance >>>>>
java.io.FileNotFoundException: Settings.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at... (2 Replies)
If my file is:
Wed Sep 9 22:45:14 EDT 2009
sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp> sftp>
This is log file generated from transfer...
sftp> sftp> sftp> sftp> Files placed properly....
sftp> sftp> sftp>
How can I remove "sftp>" word from this... (4 Replies)
i have a question about to remove first word from a sentence.
$msgtxt = "this is a test script";
my @ap_txtMsg = split(/ +/, trim_data($msgtxt));
$ap_msgtxt = splice (@ap_txtMsg, 0, 1);
but the output is first word that i... (1 Reply)