03-13-2013
Quote:
Originally Posted by
siya@
Hi,
Sorry for the confusion!!
I want to basically convert ONLY the
first column of my entire sequence
from
PH01000000G0240 to
string0G0240
PH01000001G0190 to
string1G0190
PH01000002G0120 to
string2G0120
,....
....
PH01270000G0010 to
string270000G0010
PH01278028G0014 to
string278028G0014
PH012781040010 to
string278104
G0010
With respect to code,why does it have {0,4 }in initial part?
I dint understand the part in code : awk 'match($1, /^PH010{0,4}/)
Please do advise.
Thanks
Apparently my script didn't work for you. That is because you won't describe in English the transformation that is to be performed. I explained in my last post what the script I gave you would do. And, it made all of the transformations your 5 examples showed.
But, it will not insert the G shown in red in your new example. That G did not appear at all in the 1st string whether or not we would break it into an initial 10 character field and a 2nd field with the remaining characters, or left it as a single field.
PLEASE explain in English what you are trying to do instead of giving a small set of inconsistent examples!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to split a file containing millions of records.
I am issuing the command
split -l 20000 filename which will split the file in 20K records each.
It works fine except in some files, data after one particular field is lost( the field with space).
Say the record is ... (4 Replies)
Discussion started by: superprogrammer
4 Replies
2. Shell Programming and Scripting
Can anyone tell me what this command will do?
split -b$SPLITSIZE - $file1 < $file2
Will it split file1 or file2? Please explain.
Malay (1 Reply)
Discussion started by: malaymaru
1 Replies
3. UNIX for Advanced & Expert Users
HI! All
iam using Split command to split a large .txt file in to smaller files,
The syntax iam using
split -25000 Product.txt
iam getting four output files but not in .txt format but in some other format ,
when i checked the properties the Type of the output files is Type
can any... (7 Replies)
Discussion started by: mohdtausifsh
7 Replies
4. UNIX for Advanced & Expert Users
Hi,
I have to split a line of the form
1232423#asdf#124324#54534#dcfg#wert#rrftt#4567
into an array in perl. I am using
@fields;
@fields=split('#',$line);
if($fields eq "1")
But this is not working. By using the syntax, the statements in "if" are never executed. Please help.... (9 Replies)
Discussion started by: rochitsharma
9 Replies
5. UNIX for Dummies Questions & Answers
Is there an option or a way with the split command to rename the partitioned files with a counter. For example, can the files testaa, testab, testac be renamed to test1, test2, test3 from the split command without explicilty renaming files.
Thanks,
- CB (3 Replies)
Discussion started by: ChicagoBlues
3 Replies
6. UNIX for Advanced & Expert Users
./myapp | split -b 10m -d -a 1 - "myappLog"
here split command is reading the input from the output of myapp and it will write the text in to file where in each file size is 10MB and it will create upto 10 files.
I have observed split is flushing the data for every 4096 bytes. if my... (7 Replies)
Discussion started by: arv600
7 Replies
7. UNIX for Dummies Questions & Answers
hi all,
i have problem with my script in unix ...i have script with split -d (--numeric-suffixes) in linux its working but in solaris machine the option -d isn't have
so how to i can change split -d (this output) will same in output solaris can i change with awk and how do that
thx before (2 Replies)
Discussion started by: zvtral
2 Replies
8. Shell Programming and Scripting
Hi,
There is an awk command in script and it is running successfully.
I want to split that command in 2 lines.
I have tried using '\' but its not working..
Please suggest me the solution. (11 Replies)
Discussion started by: Sanket Dalvi
11 Replies
9. UNIX for Beginners Questions & Answers
Hi All,
I want to split the file after size gets above 100kb.
So I am using below command.
split -b 100kb File.txt Test
But after first file, my record is breaking as in middle of the record, size of file is getting above 100kb. So after splitting half record is in one file and half... (1 Reply)
Discussion started by: Amey Dixit
1 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I have a txt file which I would like to partition into 2 separate output files. I would like to partition the odd or even groups of 4 lines from the txt file. So I would like lines 1-4 to go to file1, and lines 5-8 to go to file2, and so on until the whole txt file is divided into two... (1 Reply)
Discussion started by: landrjos
1 Replies
LEARN ABOUT DEBIAN
ausearch-expression
AUSEARCH-EXPRESSION(5) Linux Audit AUSEARCH-EXPRESSION(5)
NAME
ausearch-expression - audit search expression format
OVERVIEW
This man page describes the format of "ausearch expressions". Parsing and evaluation of these expressions is provided by libauparse and is
common to applications that use this library.
LEXICAL STRUCTURE
White space (ASCII space, tab and new-line characters) between tokens is ignored. The following tokens are recognized:
Punctuation
( )
Logical operators
! && ||
Comparison operators
< <= == > >= !== i= i!= r= r!=
Unquoted strings
Any non-empty sequence of ASCII letters, digits, and the _ symbol.
Quoted strings
A sequence of characters surrounded by the " quotes. The character starts an escape sequence. The only defined escape sequences
are \ and ". The semantics of other escape sequences is undefined.
Anywhere an unquoted string is valid, a quoted string is valid as well, and vice versa. In particular, field names may be specified using
quoted strings, and field values may be specified using unquoted strings.
EXPRESSION SYNTAX
The primary expression has the following form:
field comparison-operator value
field is either a string, which specifies the first field with that name within the current audit record, or the escape character fol-
lowed by a string, which specifies a virtual field with the specified name (virtual fields are defined in a later section).
field is a string. operator specifies the comparison to perform
r= r!= Get the "raw" string of field, and compare it to value. For fields in audit records, the "raw" string is the exact string stored in
the audit record (with all escaping and unprintable character encoding left alone); applications can read the "raw" string using
auparse_get_field_str(3). Each virtual field may define a "raw" string. If field is not present or does not define a "raw" string,
the result of the comparison is false (regardless of the operator).
i= i!= Get the "interpreted" string of field, and compare it to value. For fields in audit records, the "interpreted" string is an "user-
readable" interpretation of the field value; applications can read the "interpreted" string using auparse_interpret_field(3). Each
virtual field may define an "interpreted" string. If field is not present or does not define an "interpreted" string, the result of
the comparison is false (regardless of the operator).
< <= == > >= !==
Evaluate the "value" of field, and compare it to value. A "value" may be defined for any field or virtual field, but no "value" is
currently defined for any audit record field. The rules of parsing value for comparing it with the "value" of field are specific
for each field. If field is not present, the result of the comparison is false (regardless of the operator). If field does not
define a "value", an error is reported when parsing the expression.
If E1 and E2 are valid expressions, then ! E1, E1 && E2, and E1 || E2 are valid expressions as well, with the usual C semantics and evalu-
ation priorities. Note that ! field op value is interpreted as !(field op value), not as (!field) op value.
VIRTUAL FIELDS
The following virtual fields are defined:
imestamp
The value is the timestamp of the current event. value must have the ts:seconds.milli format, where seconds and milli are decimal
numbers specifying the seconds and milliseconds part of the timestamp, respectively.
ecord_type
The value is the type of the current record. value is either the record type name, or a decimal number specifying the type.
SEMANTICS
The expression as a whole applies to a single record. The expression is true for a specified event if it is true for any record associated
with the event.
EXAMPLES
As a demonstration of the semantics of handling missing fields, the following expression is true if field is present:
(field r= "") || (field r!= "")
and the same expression surrounded by !( and ) is true if field is not present.
FUTURE DIRECTIONS
New escape sequences for quoted strings may be defined.
For currently defined virtual fields that do not define a "raw" or "interpreted" string, the definition may be added. Therefore, don't
rely on the fact that comparing the "raw" or "interpreted" string of the field with any value is false.
New formats of value constants for the imestamp virtual field may be added.
AUTHOR
Miloslav Trmac
Red Hat Feb 2008 AUSEARCH-EXPRESSION(5)