How do I remove leading spaces in UNIX when count of space character is not fixed? Example below-
Script showStreamsGLIS$reg.$env.ksh gives me output as below-
My requirement is to get rows containing status as 'OI/OH/RU' (highlighted few possible status values) and remove all trailing spaces. And I am trying to integrate this code in a perl script.
Idea is to do it without saving the output in a file.
Dear All,
can you please advice how do i remove trailing and leading spaces from a pipe-delimited file using "tr" command
the below cmd, i tried removed all spaces
tr -d ' '<s1.txt>s2.txt1
Many thx
Suresh (5 Replies)
Hi Experts,
In a file tht i copied from the web , i am not able to remove the leading white spaces. I tried the below , none of them working . I opened the file through vi to check for the special characters if any , but no such characters found.
Your advice will be greatly appreciated.
sed... (5 Replies)
Hi,
I need add leading zeroes to a field in a file based on the character count. The field can be of 1 character to 6 character length. I need to make the field 14bytes.
eg:
8351,20,1
8351,234,6
8351,2,0
8351,1234,2
8351,123456,1
8351,12345,2
This should become.
... (3 Replies)
I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file.
If the length is less than the max length, the spaces should be appended... (4 Replies)
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
data.txt
{
"auth_type": "role",
"default_attributes": {
"sudoers": {
i need to know how manyspaces are before an actual character in each line of a file.
for example. in the above data.txt,
There are 0 spaces leading up to {
There are 4 spaces leading up to the... (7 Replies)
Hi,
I am trying to remove leading and trailing spaces from a file using awk but somehow I have not been able to do it.
Here is the data that I want to trim.
07/12/2017 15:55:00 |entinfdev |AD ping Time ms | .474| 1.41| .581|green |flat... (9 Replies)
OS : RHEL 6.7
Shell : bash
I am trying to remove the leading the spaces in the below file
$ cat pattern2.txt
hello1
hello2
hello3
hello4
Expected output is shown below.
$ cat pattern2.txt
hello1
hello2
hello3
hello4 (2 Replies)
Discussion started by: John K
2 Replies
LEARN ABOUT PHP
cubrid_prepare
CUBRID_PREPARE(3) 1 CUBRID_PREPARE(3)cubrid_prepare - Prepare a SQL statement for executionSYNOPSIS
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)