Removing blank spaces


 
Thread Tools Search this Thread
Operating Systems Solaris Removing blank spaces
# 1  
Old 08-02-2011
How to execute a command in vi

Hi ,
I want to go out of vi editor temporarily and execute a command in command prompt and again going back to the editor . Is it possible . Any help on this is really helpful.

1. Need to open vi
2. Temporarily come out and execute a command and go back to vi editor

Last edited by rogerben; 08-02-2011 at 02:55 AM.. Reason: changed the subject line
rogerben
# 2  
Old 08-02-2011
Code:
tr -d ' '

# 3  
Old 08-02-2011
To execute an operating system command from within vi, just type for example
Code:
:!ls -l /tmp<CR>

You can also fork a subshell with
Code:
:sh<CR>

---------- Post updated at 07:57 ---------- Previous update was at 07:54 ----------

You can also send the current contents of the vi editor buffer through a filter program with
Code:
1G!Gtr -d ' '<CR>

1G ... to go to the first line
!G ... send everything from the current position up to the last line through the following command
tr -d ' ' ... the tr command to delete spaces
<CR> ... to terminate the command sequence
# 4  
Old 08-02-2011
Quote:
Originally Posted by hergp
To execute an operating system command from within vi, just type for example
Code:
:!ls -l /tmp<CR>

You can also fork a subshell with
Code:
:sh<CR>

---------- Post updated at 07:57 ---------- Previous update was at 07:54 ----------

You can also send the current contents of the vi editor buffer through a filter program with
Code:
1G!Gtr -d ' '<CR>

1G ... to go to the first line
!G ... send everything from the current position up to the last line through the following command
tr -d ' ' ... the tr command to delete spaces
<CR> ... to terminate the command sequence

Thanks a lot. Its workingSmilie
rogerben
# 5  
Old 08-02-2011
@rogerben: please don't change a question to a totally different one while it has already been answered. Editing should be done to clarify an existing question, not to ask another one. In the latter case, either ask it in the thread if you feel there is a relationship or in a different thread where it would get a better visibility.
# 6  
Old 08-03-2011
Hi Rojer,

Hope your query is answer by now but I would also like to point you towards the use of
Code:
screen

command

This screen command creates a new screen under a same window and it acts as if there are 2 sessions running.

Try this screen concept and revert back if it helps you cause.
Quote:
Originally Posted by rogerben
Hi ,
I want to go out of vi editor temporarily and execute a command in command prompt and again going back to the editor . Is it possible . Any help on this is really helpful.

1. Need to open vi
2. Temporarily come out and execute a command and go back to vi editor
# 7  
Old 01-30-2012
Vivek,
The screen command is not working . Can you pls let me know the exact usage of the screen command
rogerben
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

Hi Gurus, Somebody can say me how to delete blank spaces and blank lines in a file unix, please. Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies

2. Shell Programming and Scripting

Removing blank/white spaces and special characters

Hello All , 1. I am trying to do a task where I need to remove Blank spaces from my file , I am usingawk '{$1=$1}{print}' file>file1Input :- ;05/12/1990 ;31/03/2014 ; Output:- ;05/12/1990 ;31/03/2014 ;This command is not removing all spaces from... (6 Replies)
Discussion started by: himanshu sood
6 Replies

3. Emergency UNIX and Linux Support

Removing ONLY UNIQUE blank spaces with sed?

Hi, I have data that looks similar to this: In which the sentences are written horizontally and the beginning of a sentence is indicated by a 1 in the first column and the number increments until the last item of the sentence. The end of the sentence and the beginning of the next is then indicate... (1 Reply)
Discussion started by: owwow14
1 Replies

4. Shell Programming and Scripting

removing blank spaces in a script

Hi I am writing a shell to run sqlplus scripts. i found a issue in my scripts that oracle will not spool a file if there is blank spaces in the word like /backup dir/scriptrelease/1_DDL or /backupdir/script release/2_DDL can we write some thing in the shell to make "/backup dir" to... (1 Reply)
Discussion started by: srichunduru
1 Replies

5. Shell Programming and Scripting

how to read blank spaces

hi i have a file which store some data.the contents of my file is data1:data2 data3:data4 i have a script which read this file correct="$(cat /root/sh | cut -d: -f1)" i used this syntax..please help me which syntax is used to read blank spaces.and then remove it and after that how to read... (1 Reply)
Discussion started by: shubhig15
1 Replies

6. UNIX for Dummies Questions & Answers

Removing blank spaces from text files in UNIX

Hello, I am an super newbie, so forgive my sheer ignorance. I have a series of text files formatted as follows (just showing the header and first few lines): mean_geo mean_raw lat lon 0.000 0 -70.616 163.021 0.000 0 -70.620 163.073 0.000 ... (8 Replies)
Discussion started by: vtoniolo
8 Replies

7. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

8. Shell Programming and Scripting

Handling blank spaces

Hi, I am trying to replace a specific column values in a csv file with double quotes when I am find embedded spaces with in the fields. Example: SNO,NAME,ZIPCODE,RANK,SEX,ADDRESS 1,Robert,74538,12,34, M,Robert Street, NY 2,Sam,07564,13,M,12 Main Ave, CA 3,Kim, Ed,12345,14,M,123D ,... (1 Reply)
Discussion started by: techmoris
1 Replies

9. UNIX for Dummies Questions & Answers

string with blank spaces

I have a file that has dates like this: date FINAL_RESULT; 7 date FINAL_RESULT; 2 date FINAL_RESULT; 5 With this command: seira=`cut -f2 -d\; tes.txt` i take the date FINAL RESULTs and i store them on variable seira.then seira look like this: 6 3 8 I want to read seira and make a sum of all... (4 Replies)
Discussion started by: psalas
4 Replies

10. Shell Programming and Scripting

Removing blank spaces from a file?

Guys, I need some help... how can I remove the blank spaces between the lines below? (between the date and the hour fields) 21/05/07 00:05:00 99 21/05/07 00:10:01 99 21/05/07 00:15:00 99 21/05/07 00:20:00 99 21/05/07 00:25:00 99 I want to make the file... (4 Replies)
Discussion started by: dfs
4 Replies
Login or Register to Ask a Question