10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email.
Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string.
GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies
2. Shell Programming and Scripting
Hi,
name=VDSL_TTV_ HN_SUB create coid=MA5603U phone=5678 portpolicy=APortSelectionPolicy rfu10=TTV rfu3=Dot1q sz7_portmode=VDSL2 rfu5=1234 srprofile.sy_profname=$ADSL_TTV_SubProfile1
I have a line like this. Its a single line.I need the output as
name=VDSL_TTV_ HN_SUB create... (6 Replies)
Discussion started by: giri_luck
6 Replies
3. Shell Programming and Scripting
Hi,
name=VDSL_TTV_ HN_SUB create coid=MA5603U phone=5678 portpolicy=APortSelectionPolicy rfu10=TTV rfu3=Dot1q sz7_portmode=VDSL2 rfu5=1234 srprofile.sy_profname=$ADSL_TTV_SubProfile1
I have a line like this. Its a single line.I need the output as
name=VDSL_TTV_ HN_SUB create... (1 Reply)
Discussion started by: giri_luck
1 Replies
4. Shell Programming and Scripting
Hello All,
I have a case, wherein I have a string of the format
"attr1=value1 attr2=value2 attr3=value3 attr4=value4"
How do I extract the value associated with for a given attributename. For eg. I need to get a value of "value2" when I give an input for attribute name as "attr2". Note, each... (10 Replies)
Discussion started by: msgforsunil
10 Replies
5. Shell Programming and Scripting
I need the perl solution for the following :
$string="I LOVE INDIA"
now, in a new string i need the first character of each word...
that is string2 should be "ILN". (10 Replies)
Discussion started by: vijay_0209
10 Replies
6. Shell Programming and Scripting
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies
7. Shell Programming and Scripting
hi
i am new to Shell scripting
i have a string "hostName=lpdma520_dev_ipc_us_aexp_com"
now i need to parse the string as "var1=lpdma520"
please help (7 Replies)
Discussion started by: satish@123
7 Replies
8. Programming
how can i remove the special characters
hi iam print the string variable .
suppse:
while(str!=NULL)
printf("******* %s ********** %d ",str,strlen(str));
output as:
****srinu ******** 5
****
phani******** 63
****srinu ******** 5
****
phani******** 63
so my problem is how can i... (3 Replies)
Discussion started by: phani_sree
3 Replies
9. Shell Programming and Scripting
String example:
/vmfs/volumes/46000471-71d7c414-8f74-0013210cddc3/gistst/gistst.vmx
What I would like to do is create a variable and save gistst in it.
I thought if I could create an array and split it by '/'
then I could use the 4th array element or if they was a way to do a... (13 Replies)
Discussion started by: magnacrazy
13 Replies
10. UNIX for Dummies Questions & Answers
I am passing argument 1-13 to a sh file.
I want to parse the string and the get the numbers on either side of "-" in two different variables.
I am not familiar with unix .. how can i do this? (3 Replies)
Discussion started by: rolex.mp
3 Replies
cut(1) User Commands cut(1)
NAME
cut - cut out selected fields of each line of a file
SYNOPSIS
cut -b list [-n] [file]...
cut -c list [file]...
cut -f list [-d delim] [-s] [file]...
DESCRIPTION
Use the cut utility to cut out columns from a table or fields from each line of a file; in data base parlance, it implements the projection
of a relation. The fields as specified by list can be fixed length, that is, character positions as on a punched card (-c option) or the
length can vary from line to line and be marked with a field delimiter character like TAB (-f option). cut can be used as a filter.
Either the -b, -c, or -f option must be specified.
Use grep(1) to make horizontal ``cuts'' (by context) through a file, or paste(1) to put files together column-wise (that is, horizontally).
To reorder columns in a table, use cut and paste.
OPTIONS
The following options are supported:
list A comma-separated or blank-character-separated list of integer field numbers (in increasing order), with optional - to indi-
cate ranges (for instance, 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short for third through last field)).
-b list The list following -b specifies byte positions (for instance, -b1-72 would pass the first 72 bytes of each line). When -b and
-n are used together, list is adjusted so that no multi-byte character is split.
-c list The list following -c specifies character positions (for instance, -c1-72 would pass the first 72 characters of each line).
-d delim The character following -d is the field delimiter (-f option only). Default is tab. Space or other characters with special
meaning to the shell must be quoted. delim can be a multi-byte character.
-f list The list following -f is a list of fields assumed to be separated in the file by a delimiter character (see -d ); for
instance, -f1,7 copies the first and seventh field only. Lines with no field delimiters will be passed through intact (useful
for table subheadings), unless -s is specified.
-n Do not split characters. When -b list and -n are used together, list is adjusted so that no multi-byte character is split.
-s Suppresses lines with no delimiter characters in case of -f option. Unless specified, lines with no delimiters will be passed
through untouched.
OPERANDS
The following operands are supported:
file A path name of an input file. If no file operands are specified, or if a file operand is -, the standard input will be used.
USAGE
See largefile(5) for the description of the behavior of cut when encountering files greater than or equal to 2 Gbyte (2^31 bytes).
EXAMPLES
Example 1 Mapping user IDs
A mapping of user IDs to names follows:
example% cut -d: -f1,5 /etc/passwd
Example 2 Setting current login name
To set name to current login name:
example$ name=`who am i | cut -f1 -d' '`
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of cut: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All input files were output successfully.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
grep(1), paste(1), attributes(5), environ(5), largefile(5), standards(5)
DIAGNOSTICS
cut: -n may only be used with -b
cut: -d may only be used with -f
cut: -s may only be used with -f
cut: cannot open <file>
Either file cannot be read or does not exist. If multiple files are present, processing continues.
cut: no delimiter specified
Missing delim on -d option.
cut: invalid delimiter
cut: no list specified
Missing list on -b, -c, or -f option.
cut: invalid range specifier
cut: too many ranges specified
cut: range must be increasing
cut: invalid character in range
cut: internal error processing input
cut: invalid multibyte character
cut: unable to allocate enough memory
SunOS 5.11 29 Apr 1999 cut(1)