Sponsored Content
Full Discussion: Append Spaces to a string
Top Forums UNIX for Dummies Questions & Answers Append Spaces to a string Post 302880935 by Don Cragun on Tuesday 24th of December 2013 06:50:39 PM
Old 12-24-2013
Moderator's Comments:
Mod Comment Akshay Hegde's post has been hidden until we determine whether or not this thread is a misposted homework item.

Venu Gopal: If this is a homework item, let us know quickly so we can close this thread and you can resubmit the question in the proper forum with the filled out homework template. If this is not a homework item, please explain to us what you are working on that requires padding a field to 100 characters.

Akshay Hegde: Our continued support by class instructors depends on us recognizing homework items and on us to help students learn how to do their own homework. The UNIX and Linux Forums can't be thought of as a way for students to get someone else (us) to do their homework for them.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Append strings with filler spaces

Hi I am looping through the contents of a file as follows cat file |while read inrec do echo $inrec >> $TMP done (obviously this isn't all i am doing as it would be pointless but for the sake of the problem this is the important bit) The file has fields which are separated by... (1 Reply)
Discussion started by: handak9
1 Replies

2. Shell Programming and Scripting

Append Spaces At end of each line Leaving Header and Footer

How to append constant No of spaces suppose 52 at end of each line in a file (xyz) excluding first and last line. Please Help me out for the same. (1 Reply)
Discussion started by: deepam
1 Replies

3. Shell Programming and Scripting

append string with spaces to a line

hi i have a file like (every string contains 16 chars) CTL1330000000000 0000 00 008000 0080000000 i need to form a line and write to a file CTL13300000000000000 00008000 0080000000 total chars should be 64 ... (2 Replies)
Discussion started by: Satyak
2 Replies

4. UNIX for Dummies Questions & Answers

Read a string with leading spaces and find the length of the string

HI In my script, i am reading the input from the user and want to find the length of the string. The input may contain leading spaces. Right now, when leading spaces are there, they are not counted. Kindly help me My script is like below. I am using the ksh. #!/usr/bin/ksh echo... (2 Replies)
Discussion started by: dayamatrix
2 Replies

5. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

6. Shell Programming and Scripting

append end of line with 8 spaces

child_amt=$amount prev_line="$prev_line $child_amt" i am getting the result like this 21234567890001343 000001004OLFXXX029100020091112 0000060 but i want 8 spaces between the eg: 21234567890001343 000001004OLFXXX029100020091112 0000060 how can i do this in .ksh (1 Reply)
Discussion started by: kshuser
1 Replies

7. AIX

How to append spaces to string values?

i/o file: abc,efg,xyz Required o/p file: "abc (Value + blank spaces=16) " ,"efg (Value +blank spaces=15) " ,"xyz (Value+ blank spaces =20) " In short input file value stores in result file with " i/p Value " added with spaces and are of fixed size like 16,15,20 How to do using... (2 Replies)
Discussion started by: AhmedLakadkutta
2 Replies

8. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

9. Shell Programming and Scripting

append blank spaces at the end of a variable string

Hello, could you please help with this one. I have an input file like this: 123,4567,89000 123456789,9876543,12 and for the output I need strings to be with the fixed length, let's say 15, and if the string is -lt 15 to be populated with blanks at the end until it reach 15, like this: 123 ,4567... (1 Reply)
Discussion started by: apenkov
1 Replies

10. Shell Programming and Scripting

Append spaces the rows to make it into a required fixed length file

I want to make a script to read row by row and find its length. If the length is less than my required length then i hav to append spaces to that paritucular row. Each row contains special characters, spaces, etc. For example my file contains , 12345 abcdef 234 abcde 89012 abcdefgh ... (10 Replies)
Discussion started by: Amrutha24
10 Replies
Net::DBus::Binding::Iterator(3pm)			User Contributed Perl Documentation			 Net::DBus::Binding::Iterator(3pm)

NAME
Net::DBus::Binding::Iterator - Reading and writing message parameters SYNOPSIS
Creating a new message my $msg = new Net::DBus::Binding::Message::Signal; my $iterator = $msg->iterator; $iterator->append_boolean(1); $iterator->append_byte(123); Reading from a mesage my $msg = ...get it from somewhere... my $iter = $msg->iterator(); my $i = 0; while ($iter->has_next()) { $iter->next(); $i++; if ($i == 1) { my $val = $iter->get_boolean(); } elsif ($i == 2) { my $val = $iter->get_byte(); } } DESCRIPTION
Provides an iterator for reading or writing message fields. This module provides a Perl API to access the dbus_message_iter_XXX methods in the C API. The array and dictionary types are not yet supported, and there are bugs in the Quad support (ie it always returns -1!). METHODS
$res = $iter->has_next() Determines if there are any more fields in the message itertor to be read. Returns a positive value if there are more fields, zero otherwise. $success = $iter->next() Skips the iterator onto the next field in the message. Returns a positive value if the current field pointer was successfully advanced, zero otherwise. my $val = $iter->get_boolean() $iter->append_boolean($val); Read or write a boolean value from/to the message iterator my $val = $iter->get_byte() $iter->append_byte($val); Read or write a single byte value from/to the message iterator. my $val = $iter->get_string() $iter->append_string($val); Read or write a UTF-8 string value from/to the message iterator my $val = $iter->get_object_path() $iter->append_object_path($val); Read or write a UTF-8 string value, whose contents is a valid object path, from/to the message iterator my $val = $iter->get_signature() $iter->append_signature($val); Read or write a UTF-8 string, whose contents is a valid type signature, value from/to the message iterator my $val = $iter->get_int16() $iter->append_int16($val); Read or write a signed 16 bit value from/to the message iterator my $val = $iter->get_uint16() $iter->append_uint16($val); Read or write an unsigned 16 bit value from/to the message iterator my $val = $iter->get_int32() $iter->append_int32($val); Read or write a signed 32 bit value from/to the message iterator my $val = $iter->get_uint32() $iter->append_uint32($val); Read or write an unsigned 32 bit value from/to the message iterator my $val = $iter->get_int64() $iter->append_int64($val); Read or write a signed 64 bit value from/to the message iterator. An error will be raised if this build of Perl does not support 64 bit integers my $val = $iter->get_uint64() $iter->append_uint64($val); Read or write an unsigned 64 bit value from/to the message iterator. An error will be raised if this build of Perl does not support 64 bit integers my $val = $iter->get_double() $iter->append_double($val); Read or write a double precision floating point value from/to the message iterator my $value = $iter->get() my $value = $iter->get($type); Get the current value pointed to by this iterator. If the optional $type parameter is supplied, the wire type will be compared with the desired type & a warning output if their differ. The $type value must be one of the "Net::DBus::Binding::Message::TYPE*" constants. my $hashref = $iter->get_dict() If the iterator currently points to a dictionary value, unmarshalls and returns the value as a hash reference. my $hashref = $iter->get_array() If the iterator currently points to an array value, unmarshalls and returns the value as a array reference. my $hashref = $iter->get_variant() If the iterator currently points to a variant value, unmarshalls and returns the value contained in the variant. my $hashref = $iter->get_struct() If the iterator currently points to an struct value, unmarshalls and returns the value as a array reference. The values in the array correspond to members of the struct. $iter->append($value) $iter->append($value, $type) Appends a value to the message associated with this iterator. The value is marshalled into wire format, according to the following rules. If the $value is an instance of Net::DBus::Binding::Value, the embedded data type is used. If the $type parameter is supplied, that is taken to represent the data type. The type must be one of the "Net::DBus::Binding::Message::TYPE_*" constants. Otherwise, the data type is chosen to be a string, dict or array according to the perl data types SCALAR, HASH or ARRAY. my $type = $iter->guess_type($value) Make a best guess at the on the wire data type to use for marshalling $value. If the value is a hash reference, the dictionary type is returned; if the value is an array reference the array type is returned; otherwise the string type is returned. my $sig = $iter->format_signature($type) Given a data type representation, construct a corresponding signature string $iter->append_array($value, $type) Append an array of values to the message. The $value parameter must be an array reference, whose elements all have the same data type specified by the $type parameter. $iter->append_struct($value, $type) Append a struct to the message. The $value parameter must be an array reference, whose elements correspond to members of the structure. The $type parameter encodes the type of each member of the struct. $iter->append_dict($value, $type) Append a dictionary to the message. The $value parameter must be an hash reference.The $type parameter encodes the type of the key and value of the hash. $iter->append_variant($value) Append a value to the message, encoded as a variant type. The $value can be of any type, however, the variant will be encoded as either a string, dictionary or array according to the rules of the "guess_type" method. my $type = $iter->get_arg_type Retrieves the type code of the value pointing to by this iterator. The returned code will correspond to one of the constants "Net::DBus::Binding::Message::TYPE_*" my $type = $iter->get_element_type If the iterator points to an array, retrieves the type code of array elements. The returned code will correspond to one of the constants "Net::DBus::Binding::Message::TYPE_*" AUTHOR
Daniel P. Berrange COPYRIGHT
Copyright (C) 2004-2011 Daniel P. Berrange SEE ALSO
Net::DBus::Binding::Message perl v5.14.2 2011-06-30 Net::DBus::Binding::Iterator(3pm)
All times are GMT -4. The time now is 11:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy