Sponsored Content
Top Forums Shell Programming and Scripting vim Script: Switching between modes Post 302529155 by dkr on Wednesday 8th of June 2011 04:28:23 PM
Old 06-08-2011
vim Script: Switching between modes

Hi All,

I've been using vi for about 10 years, but this is my first attempt at creating a vi script. I am reformatting some files to create CSVs for import into a database. In the script, I have a bunch of substitute lines that work fine, but I'm trying to figure out how to get the script into insert mode and then back to command mode so I can run commands such as:

d1G
dG
1G

I've tried typing <ESC> into the script, but vi doesn't seem to recognize it. What can I use to switch modes?

Thanks,

Dkr.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

linux communications modes

what r the ways in which a linux application communicate with an external system like linux or windows? (1 Reply)
Discussion started by: shil
1 Replies

2. Post Here to Contact Site Administrators and Moderators

different modes?

What are the Guided and Enhanced Modes? This is something new right? Or have I been the most unobservant guy on the face of this planet? At first I thought it was something for Gollum the forumbot, but its there everytime you start a new thread. What is the difference between the two? And how do... (1 Reply)
Discussion started by: blowtorch
1 Replies

3. Shell Programming and Scripting

switching to another user in shell script...

Hi, I have a shell script in which I need to switch to another user and execute some commands and then come back to the original user. To make it more clear - I have to log in as user root then 'su' to jag - execute a script called backup.sh and then logout and come back to root again.. ... (1 Reply)
Discussion started by: bjagadeesh
1 Replies

4. UNIX for Dummies Questions & Answers

Switching user inside a shell script

Dear All, I want to switch a user inside a shell script.My current user say x and user y to whom i want to switch both have login on the same server,the one on which i want to execute my script on. "I want to do something like this su - y Password should be provided in the script itself.And... (6 Replies)
Discussion started by: navjotmannan
6 Replies

5. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

6. Shell Programming and Scripting

problem switching to directory using shell script

Hi, I have an issue with switching to other directory through shell script. I have used cd /Music" but that doesn't help me. Then I have also tried using alias proj 'Music' alias then I get the error permission denied but i set the chmod 777 Music. I am using cShell for my... (3 Replies)
Discussion started by: baluk
3 Replies

7. UNIX for Dummies Questions & Answers

Access Modes

What access modes (permissions) are given to new files you create? (2 Replies)
Discussion started by: naasei
2 Replies

8. Shell Programming and Scripting

Switching user inside a shell script doesn't seem to work

Linux version : Oracle Linux 6.4 Shell : Bash The following script will be run as root. During the execution, it should switch to oracle user and execute few commands. After googling and searching within unix.com , I came up with the following syntax ## Enclosing all commands in double... (7 Replies)
Discussion started by: John K
7 Replies

9. Shell Programming and Scripting

Switching server in UNIX via shell script (SSH )

Requirement: I am writing a shell script which take some file from say Server1 and I have to execute some command on Server2 then I have to manipulate the data and based on that I have to produce report. Problem:I can schedule the shell script on only one server (Server1 or Server2) So, In the... (3 Replies)
Discussion started by: raks2301
3 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-a] [-c COMMAND] [-f] [-q] [-t] [file] DESCRIPTION
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. Options: -a Append the output to file or typescript, retaining the prior contents. -c COMMAND Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -f Flush output after each write. This is nice for telecooperation: One person does `mkfifo foo; script -f foo' and another can super- vise real-time what is being done using `cat foo'. -q Be quiet. -t Output timing data to standard error. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1). HISTORY
The script command appeared in 3.0BSD. BUGS
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. AVAILABILITY
The script command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. Linux July 30, 2000 Linux
All times are GMT -4. The time now is 04:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy