Question on vi editing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question on vi editing
# 1  
Old 07-30-2010
Question on vi editing

If I have a text file which I am editing with vi and I perform the following editing.
HTML Code:
:1,$s/\<green\>/blue/g
Later I decide to replace all ocurance of blue to red, then instead of writing the above editing line is there a way to recall it and work on it, instead of repeating the entire editing script?

Please suggest.
This User Gave Thanks to Tirmazi For This Post:
# 2  
Old 07-31-2010
Are you using vi oder vim? In vim you can use the up and down arrows to browse through the command history. Or you can type in normal mode "q:" to edit the command history.

HTH Chris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

2. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

3. Post Here to Contact Site Administrators and Moderators

Editing your post

Hi, Can you please advise if there is an option to edit your original post or is the only option is to post a reply? Thanks in advance. (4 Replies)
Discussion started by: newbie_01
4 Replies

4. Shell Programming and Scripting

editing headers

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta 58 390 A GTATACATTATTGATGAAGTCCACATGCTTTCTATGGGTGCCTTCAATGCGCTTTTAAAA (7 Replies)
Discussion started by: Lucky Ali
7 Replies

5. Shell Programming and Scripting

substitution without editing

I have a script with 100's of lines in it. I want to edit the script with out manually openning it (with vi editor or some thing like that). Basically I want to do a substitution using regular expression (%s/G_/28_/i). Please let me know the best way to do this. (4 Replies)
Discussion started by: Lucky Ali
4 Replies

6. Shell Programming and Scripting

file editing

how to remove duplicate word in a file ? (2 Replies)
Discussion started by: mail2sant
2 Replies

7. UNIX for Dummies Questions & Answers

File editing question

I have following simple file called testing.txt ... key1=value1,key2=value2,key3=value3 ... and so on I am trying to change it to key1=value1 key2=value2 key3=value3 I tried to use following code sed 's/,/\n/g' testing.txt > temp.txt && mv temp.txt testing.txt Yet, what I am... (3 Replies)
Discussion started by: arushunter
3 Replies

8. Shell Programming and Scripting

Editing Crontab

Hi I am not able to edit crontab. Following is the comand that is being issued $crontab -e 2764 ............ This is what I am able to see But when I do $crontab -l List of all the crontab entry is displayed. Also I am seeing one entry in my /etc/cron.d prw------- 1 root ... (6 Replies)
Discussion started by: pankajkrmishra
6 Replies

9. UNIX for Dummies Questions & Answers

Editing problem

Hi, I want to do this: original file: a a hello e e bye becames: a hello e bye I think this can be done with sed or tr, but I've already tried all the options and can't find the solution. Thanks in advance (2 Replies)
Discussion started by: pmpx
2 Replies

10. Shell Programming and Scripting

Help editing a file

I have a data file which is a flat text file that has certain characters that are at the beginning of each line that identify it as being a certain type of data element. I want to write a small shell script that will take my data file and look at the beginning of certain lines and if it finds this... (8 Replies)
Discussion started by: Docboyeee
8 Replies
Login or Register to Ask a Question