Sponsored Content
Top Forums Shell Programming and Scripting Putting white Space at the end of the string Post 302864359 by CarloM on Wednesday 16th of October 2013 11:45:30 AM
Old 10-16-2013
Assuming you have printf:
Code:
printf "%-15s" $value

This User Gave Thanks to CarloM For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

stripping white space...

Hi All; Having a problem with a file.. the file contains the following data... (a snapshot) 1331F9E9DB7C2BB80EAEDE3A8F043B94,AL7 1DZ,M,50 186FDF93E1303DBA217279EC3671EA91,NG5 1JU,M,24 3783FFAF602015056A8CD21104B1AAAF,CH42 4NQ,M,17 It has 3 columns sepreated by a , the second column... (7 Replies)
Discussion started by: Zak
7 Replies

2. Programming

How to trim the white space around a string in C program

I am coding a C program to read a plain text file. There are a lot of blank fields or a string with white spaces. I want to know is there such a function called trim() in C to clean the white space around a string? Or some other way can do this efficiently? Thanks. (18 Replies)
Discussion started by: hxm1303
18 Replies

3. UNIX for Dummies Questions & Answers

SED with White Space

Dear Members, Suppose i have a variable test which stores a string as below: test='John drives+++++++++a+++++car' now i want to use sed on the above variable and replace + with a white space, so that i get echo $test should give me 'john drives a car' Between... (1 Reply)
Discussion started by: sandeep_1105
1 Replies

4. Shell Programming and Scripting

Add white space to the end of a line with sed

Im trying to add 5 blank spaces to the end of each line in a file in a sed script. I can figure out who o put the spaces pretty much anywhere else but at the end. thanks Karl (7 Replies)
Discussion started by: karlanderson
7 Replies

5. Shell Programming and Scripting

sed + white space

Hi, What sed command (if sed is the right command) can remove ALL white space from my file. I have a csv, except I want to remove all white space between commas and characters. My idea (without testing) sed 's/ //g' Is there a better way? (18 Replies)
Discussion started by: mcclunyboy
18 Replies

6. Shell Programming and Scripting

How to remove white spaces from the beginning an end of a string in unix?

Suppose, I have a variable var=" name is ". I want to remove the blank spaces from the begining and endonly, not from the entire string. So, that the variable/string looks like following var="name is". Please look after the issue. (3 Replies)
Discussion started by: mady135
3 Replies

7. Shell Programming and Scripting

Reformat a string and pad space at the end

I need to read in the string from input file and reform it by cut each segment and check the last segement lenght. If the last segment length is not as expected (see below segment file or table. It is predefined), then pad enough space. Old string FU22222222CA6666666666AKxvbFMddreeadBP999... (1 Reply)
Discussion started by: menglm
1 Replies

8. Shell Programming and Scripting

Pad space at the end of string and reformat

I need to read in the string from input file and reform it by cut each segment and check the last segement lenght. If the last segment length is not as expected (see below segment file or table. It is predefined), then pad enough space. Old string FU22222222CA6666666666AKxvbFMddreeadBP999... (11 Replies)
Discussion started by: menglm
11 Replies

9. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

10. Shell Programming and Scripting

Add white space

hi guys how can i add spacein file name with sed if strings have no space around dash input 19-20 ( 18-19 ) ABC-EFG output after add white space 19 - 20 (18 - 19 ) ABC - EFG thx in advance (2 Replies)
Discussion started by: mhs
2 Replies
CUBRID_PREPARE(3)							 1							 CUBRID_PREPARE(3)

cubrid_prepare - Prepare a SQL statement for execution

SYNOPSIS
resource cubrid_prepare (resource $conn_identifier, string $prepare_stmt, [int $option]) DESCRIPTION
The cubrid_prepare(3) function is a sort of API which represents SQL statements compiled previously to a given connection handle. This pre-compiled SQL statement will be included in the cubrid_prepare(3). Accordingly, you can use this statement effectively to execute several times repeatedly or to process long data. Only a single statement can be used and a parameter may put a question mark (?) to appropriate area in the SQL statement. Add a parameter when you bind a value in the VALUES clause of INSERT statement or in the WHERE clause. Note that it is allowed to bind a value to a MARK(?) by using the cubrid_bind(3) function only. PARAMETERS
o $conn_identifier -Connection identifier. o $prepare_stmt -Prepare query. o $option -OID return option CUBRID_INCLUDE_OID. RETURN VALUES
Request identifier, if process is successful; FALSE, if process is unsuccessful. EXAMPLES
Example #1 cubrid_prepare(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb"); $sql = <<<EOD SELECT g.event_code, e.name FROM game g JOIN event e ON g.event_code=e.code WHERE host_year = ? AND event_code NOT IN (SELECT event_code FROM game WHERE host_year=?) GROUP BY event_code; EOD; $req = cubrid_prepare($conn, $sql); cubrid_bind($req, 1, 2004); cubrid_bind($req, 2, 2000); cubrid_execute($req); $row_num = cubrid_num_rows($req); printf("There are %d event that exits in 2004 olympic but not in 2000. For example: ", $row_num); printf("%-15s %s ", "Event_code", "Event_name"); printf("---------------------------- "); $row = cubrid_fetch_assoc($req); printf("%-15d %s ", $row["event_code"], $row["name"]); $row = cubrid_fetch_assoc($req); printf("%-15d %s ", $row["event_code"], $row["name"]); cubrid_disconnect($conn); ?> The above example will output: There are 27 event that exits in 2004 olympic but not in 2000. For example: Event_code Event_name ---------------------------- 20063 +91kg 20070 64kg SEE ALSO
cubrid_execute(3), cubrid_bind(3). PHP Documentation Group CUBRID_PREPARE(3)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy