I am getting a variable as x=2006/01/18
now I have to extract each field from it.
Like x1=2006, x2=01 and x3=18.
Any idea how?
Thanks a lot for help.
Thanks
CSaha (6 Replies)
Dear friends,
I'm a novice Unix user and I'm trying to learn the ropes. I have a big task I have to accomplish and I'm convinced Unix can get the job done, I just haven't figured out how. I recently posted on the topic of cutting text between unique text patterns and somebody helped me a great... (24 Replies)
Hi,
i have a line with several fields (indefinite number of - count varies) separated by colon.
Now, i need to pick each field (except the first one) and have it assigned to variable within a loop. In other words, in the first iteration of the loop, the variable must be assigned with 2nd... (2 Replies)
Greetings,
I would like to extract records from a fixed width text file that have unique field elements.
Data is structured like this:
John A Smith NY
Mary C Jones WA
Adam J Clark PA
Mary Jones WA
Fieldname / start-end position
Firstname 1-10... (8 Replies)
I need some assistance, I am writing a script in bash.
I want to do two things:
1/. I want to replace the LF at the end of the RFH Ø ¸MQSTR ¸ so I can process the file record by record using a while loop.
2/. I want to extract two fields from each record, they are identified with... (1 Reply)
I am need to extract a number of values from a file, put have now clue how to do this.
The file looks like this:
# My file
Dest=87;CompatibleSystemSoftwareVersion=2.5300-;
Dest=87;ImageVersion=000061f3;SystemSoftwareVersion=2.5300;CDN=http://my.backup.com/download.txt;CDN_Timeout=30;
I... (3 Replies)
I have an input file with contents like:
203969 OrdAcctCycChg USAGE_DAEMON1
203970 OrdAcctCycChg USAGE_DAEMON2
203971 OrdAcctCycChg USAGE_DAEMON3
203972 OrdAcctCycChg USAGE_DAEMON4
I need to extract variables in first column... (51 Replies)
Hi All,
I am writing the following Perl Scrip and need your help in Pattern matching :
I have the following Shell Script that would read line by line from the file (file_svn) and would inturn calls the Perl Script:
#!/bin/bash
perl_path="/home/dev/filter"... (2 Replies)
I have one file A.txt which is comma separated and I want to extract first 4 field's in a file and also I want to add one more column in output
A.txt in output for all records. A.txt should not be hard coded since I do not filename it may be any file. (1 Reply)
Hello All,
I have a requirement to split the input.xml file different files and i have tried using earlier examples(where i have posted in the forum), but still no luck
Here is my input.xml
<jms-system-resource>
<name>UMSJMSSystemResource</name>
... (4 Replies)
Discussion started by: Siv51427882
4 Replies
LEARN ABOUT V7
expr
EXPR(1) General Commands Manual EXPR(1)NAME
expr - evaluate arguments as an expression
SYNOPSIS
expr arg ...
DESCRIPTION
The arguments are taken as an expression. After evaluation, the result is written on the standard output. Each token of the expression is
a separate argument.
The operators and keywords are listed below. The list is in order of increasing precedence, with equal precedence operators grouped.
expr | expr
yields the first expr if it is neither null nor `0', otherwise yields the second expr.
expr & expr
yields the first expr if neither expr is null or `0', otherwise yields `0'.
expr relop expr
where relop is one of < <= = != >= >, yields `1' if the indicated comparison is true, `0' if false. The comparison is numeric if
both expr are integers, otherwise lexicographic.
expr + expr
expr - expr
addition or subtraction of the arguments.
expr * expr
expr / expr
expr % expr
multiplication, division, or remainder of the arguments.
expr : expr
The matching operator compares the string first argument with the regular expression second argument; regular expression syntax is
the same as that of ed(1). The (...) pattern symbols can be used to select a portion of the first argument. Otherwise, the
matching operator yields the number of characters matched (`0' on failure).
( expr )
parentheses for grouping.
Examples:
To add 1 to the Shell variable a:
a=`expr $a + 1`
To find the filename part (least significant part) of the pathname stored in variable a, which may or may not contain `/':
expr $a : '.*/(.*)' '|' $a
Note the quoted Shell metacharacters.
SEE ALSO ed(1), sh(1), test(1)DIAGNOSTICS
Expr returns the following exit codes:
0 if the expression is neither null nor `0',
1 if the expression is null or `0',
2 for invalid expressions.
EXPR(1)