10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have variable named tablename. The value to tablename variable has leading and trailing white spaces. How to remove the leading and training white spaces and write the value of the tablename without space to a file using shell script. ( for e.g. tablename= yyy )
INPUT
... (10 Replies)
Discussion started by: pottic
10 Replies
2. Shell Programming and Scripting
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
3. UNIX for Dummies Questions & Answers
Using awk or sed, I'd like to remove leading spaces after a comma and before a right justified number in field 6. Sounds simple but I can't find a solution. Each field's formatting must stay intact.
Input:
40,123456-02,160,05/24/2012,02/13/1977, 10699.15,0
Output:... (5 Replies)
Discussion started by: Scottie1954
5 Replies
4. Shell Programming and Scripting
Hi,
I am having problem in deleting the leading spaces:-
cat x.csv
baseball,NULL,8798765,Most played
baseball,NULL,8928192,Most played
baseball,NULL,5678945,Most played
cricket,NOTNULL,125782,Usually played
cricket,NOTNULL,678921,Usually played
$ nawk 'BEGIN{FS=","}!a... (2 Replies)
Discussion started by: scripter12
2 Replies
5. Shell Programming and Scripting
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)
Discussion started by: panyam
5 Replies
6. Shell Programming and Scripting
Hi All,
I have a file with the following contents with multiple lines
172445957| 000005911|8| 400 Peninsula Ave.#1551 | And,K |935172445957|000005911
607573888 |000098536 | 2|Ane, B |J |Ane |1868 |19861206|20090106|20071001
I want to trim the "leading and trailing spaces only" from... (2 Replies)
Discussion started by: kumar04
2 Replies
7. Shell Programming and Scripting
#!/bin/bash
TESTVAR=" 5spaces"
echo $TESTVAR
hostame:~# ./test.sh
5spaces
The leading spaces from my variable are removed when the content is echo'd. I am trying to make some tabular data.
`echo -e` also fails.
Any suggestions? (2 Replies)
Discussion started by: grumm3t
2 Replies
8. Shell Programming and Scripting
How do I remove or add leading zeroa from a variable. To make variable 10 characters long when adding zeros. (6 Replies)
Discussion started by: toshidas2000
6 Replies
9. UNIX for Dummies Questions & Answers
I am having xml document as below.
<transactionid>
00
</transactionid>
<tracknumber>
0
</tracknumber>
<key>
N/A
</key>
But the data contains leading and trailing spaces between the tags. Please let me know how can i remove these leading and trailing spaces between the tags.... (2 Replies)
Discussion started by: jhmr7
2 Replies
10. Shell Programming and Scripting
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies