Following may help you in same, following code will check if field 1st is less than 300 then it will print 300 at first field else it will print actual 1st field's values.
Output will be as follows.
Also you can redirect this to a output file as per your requirement too.
Hi,
i am new to awk. I am using csv2pipe script(shown below)
BEGIN { FS=SUBSEP; OFS="|" }
{
result = setcsv($0, ",")
print
}
# setcsv(str, sep) - parse CSV (MS specification) input
# str, the string to be parsed. (Most likely $0.)
# sep, the separator between the values.
#
#... (6 Replies)
Dear All:
I am trying to do something that (I thought) was relatively straightforward, but my code snippet does not seem to work.
Any suggestions?
Thank you
Sincerely yours
Misha Koshelev
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include... (0 Replies)
Hi,
I have a function in a bash script that returns a string after some operations using awk.
The following code returns 555
$VARIABLE="EXAMPLE"
get_number $VARIABLE
this value I'd like to pass it as a second argument of another script with the following usage
myscript.sh <param1>... (7 Replies)
Hi All,
Sorry if the title is not good but I did not know how to explain with only some words!
What I meant is: I have a unix command built from a private application vendor that when executed it prompts for two entries by the keyboard, let's say, for example:
... (1 Reply)
Hi All,
I am hoping someone can help me with some scripting I need to complete using AWK.
I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format.
The Input file is:-
aaaa bbbbb ccccc 1 xxxx aaa bbb
aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Hi ,
i am having an file which contains 5 file_name data, i need to read the file name and will perform certain operation and generate out file names with named as 5 individual file_names
for eg:
file.txt contains
file_name1.txt|hai
file_name2.txt|bye
file_name3.txt|how... (3 Replies)
I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this?
... (12 Replies)
The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format:
input
chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18
chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT MOJAVE
mime::field::conttype
MIME::Field::ContType(3) User Contributed Perl Documentation MIME::Field::ContType(3)NAME
MIME::Field::ContType - a "Content-type" field
DESCRIPTION
A subclass of Mail::Field.
Don't use this class directly... its name may change in the future! Instead, ask Mail::Field for new instances based on the field name!
SYNOPSIS
use Mail::Field;
use MIME::Head;
# Create an instance from some text:
$field = Mail::Field->new('Content-type',
'text/HTML; charset="US-ASCII"');
# Get the MIME type, like 'text/plain' or 'x-foobar'.
# Returns 'text/plain' as default, as per RFC 2045:
my ($type, $subtype) = split('/', $field->type);
# Get generic information:
print $field->name;
# Get information related to "message" type:
if ($type eq 'message') {
print $field->id;
print $field->number;
print $field->total;
}
# Get information related to "multipart" type:
if ($type eq 'multipart') {
print $field->boundary; # the basic value, fixed up
print $field->multipart_boundary; # empty if not a multipart message!
}
# Get information related to "text" type:
if ($type eq 'text') {
print $field->charset; # returns 'us-ascii' as default
}
PUBLIC INTERFACE
boundary
Return the boundary field. The boundary is returned exactly as given in the "Content-type:" field; that is, the leading double-hyphen
("--") is not prepended.
(Well, almost exactly... from RFC 2046:
(If a boundary appears to end with white space, the white space
must be presumed to have been added by a gateway, and must be deleted.)
so we oblige and remove any trailing spaces.)
Returns the empty string if there is no boundary, or if the boundary is illegal (e.g., if it is empty after all trailing whitespace has
been removed).
multipart_boundary
Like "boundary()", except that this will also return the empty string if the message is not a multipart message. In other words,
there's an automatic sanity check.
type
Try real hard to determine the content type (e.g., "text/plain", "image/gif", "x-weird-type", which is returned in all-lowercase.
A happy thing: the following code will work just as you would want, even if there's no subtype (as in "x-weird-type")... in such a
case, the $subtype would simply be the empty string:
($type, $subtype) = split('/', $head->mime_type);
If the content-type information is missing, it defaults to "text/plain", as per RFC 2045:
Default RFC 2822 messages are typed by this protocol as plain text in
the US-ASCII character set, which can be explicitly specified as
"Content-type: text/plain; charset=us-ascii". If no Content-Type is
specified, this default is assumed.
Note: under the "be liberal in what we accept" principle, this routine no longer syntax-checks the content type. If it ain't empty,
just downcase and return it.
NOTES
Since nearly all (if not all) parameters must have non-empty values to be considered valid, we just return the empty string to signify
missing fields. If you need to get the real underlying value, use the inherited "param()" method (which returns undef if the parameter is
missing).
SEE ALSO
MIME::Field::ParamVal, Mail::Field
AUTHOR
Eryq (eryq@zeegee.com), ZeeGee Software Inc (http://www.zeegee.com). David F. Skoll (dfs@roaringpenguin.com) http://www.roaringpenguin.com
perl v5.18.2 2013-11-14 MIME::Field::ContType(3)