Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Cut pid from ps using cut command Post 302778779 by DGPickett on Monday 11th of March 2013 02:09:54 PM
Old 03-11-2013
Tools take leading whitespace characters as one empty field, many empty fields or as leading space of the first field. You might use sed, so you can control field definition with regex. The ps output is also problematic as fields change form by value. Newer ps allow you to specify what fields you want with -o.
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

2. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

3. Shell Programming and Scripting

Using :<<cut / cut to comment out block of bash script

I am using : << cut / cut to comment out block of code. Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines. The "warning " is at last line of script. done < results 169 echo "END read all positioning parameters" 170... (8 Replies)
Discussion started by: annacreek
8 Replies
Dpkg::Control::Hash(3)						   libdpkg-perl 					    Dpkg::Control::Hash(3)

NAME
Dpkg::Control::Hash - parse and manipulate a block of RFC822-like fields DESCRIPTION
The Dpkg::Control::Hash object is a hash-like representation of a set of RFC822-like fields. The fields names are case insensitive and are always capitalized the same when output (see field_capitalize function in Dpkg::Control::Fields). The order in which fields have been set is remembered and is used to be able to dump back the same content. The output order can also be overridden if needed. You can store arbitrary values in the hash, they will always be properly escaped in the output to conform to the syntax of control files. This is relevant mainly for multilines values: while the first line is always output unchanged directly after the field name, supplementary lines are modified. Empty lines and lines containing only dots are prefixed with " ." (space + dot) while other lines are prefixed with a single space. During parsing, trailing spaces are stripped on all lines while leading spaces are stripped only on the first line of each field. FUNCTIONS
my $c = Dpkg::Control::Hash->new(%opts) Creates a new object with the indicated options. Supported options are: allow_pgp Configures the parser to accept PGP signatures around the control information. Value can be 0 (default) or 1. allow_duplicate Configures the parser to allow duplicate fields in the control information. Value can be 0 (default) or 1. drop_empty Defines if empty fields are dropped during the output. Value can be 0 (default) or 1. name The user friendly name of the information stored in the object. It might be used in some error messages or warnings. A default name might be set depending on the type. $c->set_options($option, %opts) Changes the value of one or more options. my $value = $c->get_option($option) Returns the value of the corresponding option. $c->load($file) Parse the content of $file. Exits in case of errors. Returns true if some fields have been parsed. $c->parse($fh, $description) Parse a control file from the given filehandle. Exits in case of errors. $description is used to describe the filehandle, ideally it's a filename or a description of where the data comes from. It's used in error messages. Returns true if some fields have been parsed. $c->find_custom_field($name) Scan the fields and look for a user specific field whose name matches the following regex: /X[SBC]*-$name/i. Return the name of the field found or undef if nothing has been found. $c->get_custom_field($name) Identify a user field and retrieve its value. $c->save($filename) Write the string representation of the control information to a file. my $str = $c->output() "$c" Get a string representation of the control information. The fields are sorted in the order in which they have been read or set except if the order has been overridden with set_output_order(). $c->output($fh) Print the string representation of the control information to a filehandle. $c->set_output_order(@fields) Define the order in which fields will be displayed in the output() method. $c->apply_substvars($substvars) Update all fields by replacing the variables references with the corresponding value stored in the Dpkg::Substvars object. AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.0.3 2012-04-17 Dpkg::Control::Hash(3)
All times are GMT -4. The time now is 06:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy