10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I want to add the sequence length of File_1.fa and File _2.fa to form the form the fifth column in File_1_pos.txt and File_2_poa.txt respectively using awk and bash. Can anyone help me? Thanks
Get sequence length of each file
File_1.fa
File_2.fa
Add the sequence length to be the third... (6 Replies)
Discussion started by: Ibk
6 Replies
2. UNIX for Dummies Questions & Answers
Hi there, shameful Linux Newbie here :p
I was wondering if you could help with my problem...
I have plenty of files I'd like to concatenate. I know how to basically use cat command but that won't be enough from what I need : excluding the last xx bytes from files before assembling since there's... (4 Replies)
Discussion started by: grolido
4 Replies
3. Shell Programming and Scripting
I have 3 files
File1
C1 C2 c3
File 2
C1 c2 c3
File 3
C1 c2 c3
Now i want to have
File1 as C1 c2 c3 I
File2 as C1 c2 c3 O
File3 as c1 c2 c3 D
and these 3 files should be concatenated into a single file
how can it be done in unix script? (3 Replies)
Discussion started by: Codesearcher
3 Replies
4. Shell Programming and Scripting
Hi,
I have a unix file with the below structure -
CustId1 CustName1 CustPhn1 /u/home/xmldata/A000001
CustId2 CustName2 CustPhn2 /u/home/xmldata/A000002
CustId3 CustName3 CustPhn3 /u/home/xmldata/A000003
Then I have another unix directory /u/home/xmldata
This directory has... (3 Replies)
Discussion started by: Simanto
3 Replies
5. Shell Programming and Scripting
Hi
This is a simple one but I got a lost in translation when doing.
What I want to do, given both variables in the example below, to get one value at the time from both variables, for example:
1:a
2:b
etc...
I need to get this in bash scripting
code:
varas="1 2 3 4"
varbs="a b c d"... (4 Replies)
Discussion started by: ranmanh
4 Replies
6. Shell Programming and Scripting
I have the following script in a shell
# The start of a filename
file=$(ls -tr $EMT*.dat | tail -1) # Select the latest file echo $file
file_seq=$( < /u02/sct/banner/bandev2/xxxxxx/misc/EFTSQL.dat)
echo $file_seq
file2 = '$file_seq + 1'
echo $file2
It is reading a file EFTSQL.dat... (3 Replies)
Discussion started by: rechever
3 Replies
7. Shell Programming and Scripting
I want o add a variable in addition to a file which will be send with sendmail. I have problems to find the correct syntax for concatenating this variable called $MyVariable.
sendmail mai@domain.com </tmp/errormessage.txt $MyVariable]
Thanks for your help! (2 Replies)
Discussion started by: high5
2 Replies
8. Shell Programming and Scripting
Hi,
I have a table in Db2 with data say
id_1 phase1
id_1 phase2
id_1 phase3
id_2 phase1
id_2 phase2
I need to concatenate the values like
id_1 phase1,phase2,phase3
id_2 phase1,phase2
I tried recursive query but in vain as the length of string to be concatenated in quite long. ... (17 Replies)
Discussion started by: jsaravana
17 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I want to concatenate the array cell values and form a string.. Is it possible?
for ex.
I have an array
word_array contains d u m b and after concatenating the string shld be 'dumb'
thanks (2 Replies)
Discussion started by: mathur
2 Replies
10. Shell Programming and Scripting
hi
My requirement is i have a file with some records like this
file name ::xyz
a=1
b=100,200
,300,400
,500,600
c=700,800
d=900
i want to change my file
a=1
b=100,200,300,400
c=700,800
d=900
if record starts with " , " that line should fallows the previous line.please give... (6 Replies)
Discussion started by: srivsn
6 Replies
ct_telnet(3erl) Erlang Module Definition ct_telnet(3erl)
NAME
ct_telnet - Common Test specific layer on top of telnet client ct_telnet_client.erl.
DESCRIPTION
Common Test specific layer on top of telnet client ct_telnet_client.erl
Use this module to set up telnet connections, send commands and perform string matching on the result. See the unix_telnet manual page for
information about how to use ct_telnet, and configure connections, specifically for unix hosts.
The following default values are defined in ct_telnet:
Connection timeout = 10 sec (time to wait for connection)
Command timeout = 10 sec (time to wait for a command to return)
Max no of reconnection attempts = 3
Reconnection interval = 5 sek (time to wait in between reconnection attempts)
Keep alive = true (will send NOP to the server every 10 sec if connection is idle)
These parameters can be altered by the user with the following configuration term:
{telnet_settings, [{connect_timeout,Millisec},
{command_timeout,Millisec},
{reconnection_attempts,N},
{reconnection_interval,Millisec},
{keep_alive,Bool}]}.
Millisec = integer(), N = integer()
Enter the telnet_settings term in a configuration file included in the test and ct_telnet will retrieve the information automatically. Note
that keep_alive may be specified per connection if required. See unix_telnet for details.
DATA TYPES
connection() = handle() | {target_name() (see module ct), connection_type()} | target_name() (see module ct) :
connection_type() = telnet | ts1 | ts2 :
handle() = handle() (see module ct_gen_conn) :
Handle for a specific telnet connection.
prompt_regexp() = string() :
A regular expression which matches all possible prompts for a specific type of target. The regexp must not have any groups i.e. when
matching, re:run/3 shall return a list with one single element.
EXPORTS
close(Connection) -> ok | {error, Reason}
Types Connection = connection() (see module ct_telnet)
Close the telnet connection and stop the process managing it.
A connection may be associated with a target name and/or a handle. If Connection has no associated target name, it may only be
closed with the handle value (see the open/4 function).
cmd(Connection, Cmd) -> {ok, Data} | {error, Reason}
Equivalent to cmd(Connection, Cmd, DefaultTimeout) .
cmd(Connection, Cmd, Timeout) -> term()
cmdf(Connection, CmdFormat, Args) -> {ok, Data} | {error, Reason}
Equivalent to cmdf(Connection, CmdFormat, Args, DefaultTimeout) .
cmdf(Connection, CmdFormat, Args, Timeout) -> term()
cont_log(Str, Args) -> term()
end_log() -> term()
expect(Connection, Patterns) -> term()
Equivalent to expect(Connections, Patterns, []) .
expect(Connection, Patterns, Opts) -> {ok, Match} | {ok, MatchList, HaltReason} | {error, Reason}
Types Connection = connection() (see module ct_telnet)
Patterns = Pattern | [Pattern]
Pattern = string() | {Tag, string()} | prompt | {prompt, Prompt}
Prompt = string()
Tag = term()
Opts = [Opt]
Opt = {timeout, Timeout} | repeat | {repeat, N} | sequence | {halt, HaltPatterns} | ignore_prompt
Timeout = integer()
N = integer()
HaltPatterns = Patterns
MatchList = [Match]
Match = RxMatch | {Tag, RxMatch} | {prompt, Prompt}
RxMatch = [string()]
HaltReason = done | Match
Reason = timeout | {prompt, Prompt}
Get data from telnet and wait for the expected pattern.
Pattern can be a POSIX regular expression. If more than one pattern is given, the function returns when the first match is found.
RxMatch is a list of matched strings. It looks like this: [FullMatch, SubMatch1, SubMatch2, ...] where FullMatch is the string
matched by the whole regular expression and SubMatchN is the string that matched subexpression no N . Subexpressions are denoted
with '(' ')' in the regular expression
If a Tag is given, the returned Match will also include the matched Tag . Else, only RxMatch is returned.
The function will always return when a prompt is found, unless the ignore_prompt options is used.
The timeout option indicates that the function shall return if the telnet client is idle (i.e. if no data is received) for more than
Timeout milliseconds. Default timeout is 10 seconds.
The repeat option indicates that the pattern(s) shall be matched multiple times. If N is given, the pattern(s) will be matched N
times, and the function will return with HaltReason = done .
The sequence option indicates that all patterns shall be matched in a sequence. A match will not be concluded untill all patterns
are matched.
Both repeat and sequence can be interrupted by one or more HaltPatterns . When sequence or repeat is used, there will always be a
MatchList returned, i.e. a list of Match instead of only one Match . There will also be a HaltReason returned.
Examples:
expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}], [sequence,{halt,[{nnn,"NNN"}]}]).
will try to match "ABC" first and then "XYZ", but if "NNN" appears the function will return {error,{nnn,["NNN"]}} . If both "ABC"
and "XYZ" are matched, the function will return {ok,[AbcMatch,XyzMatch]} .
expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}], [{repeat,2},{halt,[{nnn,"NNN"}]}]).
will try to match "ABC" or "XYZ" twice. If "NNN" appears the function will return with HaltReason = {nnn,["NNN"]} .
The repeat and sequence options can be combined in order to match a sequence multiple times.
get_data(Connection) -> {ok, Data} | {error, Reason}
Types Connection = connection() (see module ct_telnet)
Data = [string()]
Get all data which has been received by the telnet client since last command was sent.
open(Name) -> {ok, Handle} | {error, Reason}
Equivalent to open(Name, telnet) .
open(Name, ConnType) -> {ok, Handle} | {error, Reason}
Types Name = target_name()
ConnType = connection_type() (see module ct_telnet)
Handle = handle() (see module ct_telnet)
Open a telnet connection to the specified target host.
open(KeyOrName, ConnType, TargetMod) -> {ok, Handle} | {error, Reason}
Equivalent to open(KeyOrName, ConnType, TargetMod, []) .
open(KeyOrName, ConnType, TargetMod, Extra) -> {ok, Handle} | {error, Reason}
Types KeyOrName = Key | Name
Key = atom()
Name = target_name() (see module ct)
ConnType = connection_type()
TargetMod = atom()
Extra = term()
Handle = handle()
Open a telnet connection to the specified target host.
The target data must exist in a configuration file. The connection may be associated with either Name and/or the returned Handle .
To allocate a name for the target, use ct:require/2 in a test case, or use a require statement in the suite info function ( suite/0
), or in a test case info function. If you want the connection to be associated with Handle only (in case you need to open multiple
connections to a host for example), simply use Key , the configuration variable name, to specify the target. Note that a connection
that has no associated target name can only be closed with the handle value.
TargetMod is a module which exports the functions connect(Ip,Port,KeepAlive,Extra) and get_prompt_regexp() for the given TargetType
(e.g. unix_telnet ).
send(Connection, Cmd) -> ok | {error, Reason}
Types Connection = connection() (see module ct_telnet)
Cmd = string()
Send a telnet command and return immediately.
The resulting output from the command can be read with get_data/1 or expect/2/3 .
sendf(Connection, CmdFormat, Args) -> ok | {error, Reason}
Types Connection = connection() (see module ct_telnet)
CmdFormat = string()
Args = list()
Send a telnet command and return immediately (uses a format string and a list of arguments to build the command).
SEE ALSO
unix_telnet
AUTHORS
<>
common_test 1.5.3 ct_telnet(3erl)