10 More Discussions You Might Find Interesting
1. 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
2. Shell Programming and Scripting
I have about 350 programs in which I have to add 2 lines; one before and one after a specfic line.
The following script does the job except that I lose the indentation.
#!/usr/bin/bash
while read line ... (8 Replies)
Discussion started by: jgt
8 Replies
3. 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
4. Shell Programming and Scripting
Hi friends
I need some help,
I have a file which looks as follows
TEMP 014637065 014637065 517502 517502 RTE
517502 517502 RTE
AWATER_TEST 12325 23563 588323 2323 5656 32385 23235635
ANOTHER_TEST 12 5433 FTHH 5653 833
TEST 123 123 3235 5353 353 53 35 353 535 3
YTERS GJK JKLS
... (6 Replies)
Discussion started by: lijojoseph
6 Replies
5. Shell Programming and Scripting
Hi,
Can anybody suggest me how to combine two strings with two or more white spaces and assign it to a variable?
E.g.
first=HAI
second=HELLO
third="$first $second" # appending strings with more than one white spaces
echo $third
this would print
HAI HELLO
Output appears... (2 Replies)
Discussion started by: harish_oty
2 Replies
6. Shell Programming and Scripting
I have a variable that calls in a string from txt file. Problem is the string comes with an abundance of white spaces trailing it. Is there any easy way to trim the tailing white spaces off at the end? Thanks in advance. (9 Replies)
Discussion started by: briskbaby
9 Replies
7. Shell Programming and Scripting
hi all...
i have the next question:
i have a flat file with a lot of records (lines). Each record has 10 fields, which are separated by pipe (|). My problem is what sometimes, in the first record, there are white spaces (no values, nothing) in the beginning of the record, like this:
ws ws... (2 Replies)
Discussion started by: DebianJ
2 Replies
8. 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
9. UNIX for Dummies Questions & Answers
How would I delete white spaces in a specified file?
Also, I'd like to know what command I would use to take something off a regular expression, and put it onto another.
ie.
.
.
.
expression1 <take_off>
.
.
.
expression2 (put here)
.
.
.
Any help would be great, thanks! (10 Replies)
Discussion started by: cary530
10 Replies
10. Shell Programming and Scripting
Hi,
how to i remove leading and trailing spaces from a line? the spaces can be behind or in front of any field or line
example of a line in the input data:
Amy Reds , 100 , /bin/sh
how to i get it to be: Amy Read,100,/bin/sh
i saw something on this on the Man pages for AWK... (7 Replies)
Discussion started by: sleepster
7 Replies