|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
control vi using shell scripts
i need a shell script to add the line numbers to a text file. i know how to add the line numbers using vi ( Esc :set number ), but is there a way to control vi from my shell script?
if not, how would i go about adding line numbers? |
|
#2
|
|||
|
|||
|
If installed you can use nl
nl --body-numbering=a <text.file> Example: $ cat blaat #!/bin/sh ls -al $ nl --body-numbering=a blaat 1 #!/bin/sh 2 3 ls -al |
|
#3
|
|||
|
|||
|
You can also use sed, i.e.
sed = filename | sed 'N;s/\n/ /' - F |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > control vi using shell scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|