Hi All,
I have an input_file below and i would like to use Perl to search for the term "aaa" and output the 3rd term in the same row as "aaa".For Example, i want to search for the term "ddd" and would want the code to ouput the 3rd term in the same row which is "fff". Can somebody help ?
... (28 Replies)
I am trying to select a column using a search term.
My input file looks like this (tab delimited):
ABC BJS FDG GHH DGH DFG GHF
95 456 5 266 87 4567 67
3 54 678 4567 45 6 36
232 55 3 5 6 8 34
cat filename | awk '{print $2}'above code will give me the second column. However, what I want... (2 Replies)
Hi,
I need some unix command to replace the following thing.
cat test.dat
1234|test|8/19/2009|8/20/2009|test
1234|test|8/9/2009|8/21/2009|test
1234|test|8/1/2009|8/2/2009|test
after processing
1234|test|08/19/2009|08/20/2009|test
1234|test|08/09/2009|08/21/2009|test... (6 Replies)
I need to be able to search for a string in the first column and if that string exists than replace the nth column with "-9.99".
AW12000012012 2.38 1.51 3.01 1.66 0.90 0.91 1.22 0.82 0.57 1.67 2.31 3.63 0.00
AW12000012013 1.52 0.90 1.20 1.34 1.21 0.67 ... (14 Replies)
Using Awk, how can I achieve the following?
I have set of record numbers, for which, I have to replace the nth field with some values, say spaces.
Eg:
Set of Records : 4,9,10,55,89,etc
I have to change the 8th field of all the above set of records to spaces (10 spaces).
Its a delimited... (1 Reply)
$ cat /cygdrive/d/Final2.txt
1,A ,Completed, 07.03_23.01 ,Jun 30 20:00
2,BBB,Pending,,
3,CCCCC,Pending,,
4,DDDDD,Pending,,
5,E,Pending,,
6,FFFF,Pending,,
7,G,Pending,,
In the above file 4th field is date which is in MM.DD_HH.MIN format and I need to convert it to as it is there in 5th... (1 Reply)
I have posted this again as old post is closed and I am not able to reopen. so please consider this new post
Input File :
1,A,Completed,06.02_19.36,Jun 30 20:00
2,BBB,Failed,07.04_05.12,Jul 21 19:06
3,CCCCC,New,07.21_03.03,Jul 26 12:57
4,DDDDD,Pending,,
I wast output file as:
... (7 Replies)
I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below
# For Comma seperated file without quotes
awk 'BEGIN{OFS=FS=","}$"'"$ColumnNo"'"=="'"$PPK"'"{$"'"$ColumnNo"'"="'"$NPK"'"}{print}' ${FileName} ... (5 Replies)
I am passing a variable and replace nth value with the variable.
I tried using many options in awk command but unable to ignore the special characters in the output and also unable to pass the actual value.
Input : "1","2","3"
Output : "1","1000","3"
TempVal=`echo 1000`
Cat... (2 Replies)
Hello All,
I am writing a shell script with following requirement:
1. I have one input file as below
CHE01,A,MSC,INO
CHE02,B,NST,INC
CHE03,C,STM,INP
2. In shell script I have predefined array as below:
Array1={A, B, C}
Array2= {U09, C04, A054} (6 Replies)
Discussion started by: angshuman
6 Replies
LEARN ABOUT DEBIAN
dpkg::control::fields
Dpkg::Control::Fields(3) libdpkg-perl Dpkg::Control::Fields(3)NAME
Dpkg::Control::Fields - manage (list of official) control fields
DESCRIPTION
The modules contains a list of fieldnames with associated meta-data explaining in which type of control information they are allowed. The
types are the CTRL_* constants exported by Dpkg::Control.
FUNCTIONS
my $f = field_capitalize($field_name)
Returns the field name properly capitalized. All characters are lowercase, except the first of each word (words are separated by a dash
in field names).
field_is_official($fname)
Returns true if the field is official and known.
field_is_allowed_in($fname, @types)
Returns true (1) if the field $fname is allowed in all the types listed in the list. Note that you can use type sets instead of
individual types (ex: CTRL_FILE_CHANGES | CTRL_CHANGELOG).
field_allowed_in(A|B, C) returns true only if the field is allowed in C and either A or B.
Undef is returned for non-official fields.
field_transfer_single($from, $to, $field)
If appropriate, copy the value of the field named $field taken from the $from Dpkg::Control object to the $to Dpkg::Control object.
Official fields are copied only if the field is allowed in both types of objects. Custom fields are treated in a specific manner. When
the target is not among CTRL_PKG_SRC, CTRL_PKG_DEB or CTRL_FILE_CHANGES, then they are alway copied as is (the X- prefix is kept).
Otherwise they are not copied except if the target object matches the target destination encoded in the field name. The initial X
denoting custom fields can be followed by one or more letters among "S" (Source: corresponds to CTRL_PKG_SRC), "B" (Binary: corresponds
to CTRL_PKG_DEB) or "C" (Changes: corresponds to CTRL_FILE_CHANGES).
Returns undef if nothing has been copied or the name of the new field added to $to otherwise.
field_transfer_all($from, $to)
Transfer all appropriate fields from $from to $to. Calls field_transfer_single() on all fields available in $from.
Returns the list of fields that have been added to $to.
field_ordered_list($type)
Returns an ordered list of fields for a given type of control information. This list can be used to output the fields in a predictable
order. The list might be empty for types where the order does not matter much.
field_list_src_dep()
List of fields that contains dependencies-like information in a source Debian package.
field_list_pkg_dep()
List of fields that contains dependencies-like information in a binary Debian package. The fields that express real dependencies are
sorted from the stronger to the weaker.
field_get_dep_type($field)
Return the type of the dependency expressed by the given field. Can either be "normal" for a real dependency field (Pre-Depends,
Depends, ...) or "union" for other relation fields sharing the same syntax (Conflicts, Breaks, ...). Returns undef for fields which
are not dependencies.
field_register($field, $allowed_types, %opts)
Register a new field as being allowed in control information of specified types. %opts is optional
field_insert_after($type, $ref, @fields)
Place field after another one ($ref) in output of control information of type $type.
field_insert_before($type, $ref, @fields)
Place field before another one ($ref) in output of control information of type $type.
AUTHOR
Raphael Hertzog <hertzog@debian.org>.
1.16.15 2014-06-05 Dpkg::Control::Fields(3)