|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Suppose I had a reference text file where each line was a path to a file. I need to be able to edit these files one at a time.
I have sort of an idea on how to do it, but not much code. Can anyone help me? Code:
#!/bin/bash
read -p <one file at a time> LIMIT
for ((N=1; N<$LIMIT+1; N++)); do
vi ${N}
done
|
|
#2
|
||||
|
||||
|
Quote:
in vi you can edit files like this by default. just cat the reference file and pipe it through xargs vi: Code:
cat <file_with_paths> | xargs vi
__________________
Bugs that go away by themselves come back by themselves Never take life seriously, Nobody gets out alive anyway. |
|
#3
|
||||
|
||||
|
Quote:
This is almost exactly what I'm looking for. The problem is, once I'm done editing a file, and I save it (using x in the vi command), it goes back to the terminal, and the spacing is all screwed up. How do I move to the next file? EDIT: I went to the manual for VI and found it. The command is :n Last edited by Ziptnf : January 11th, 2008 at 01:55 PM. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > Need help writing a bash script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|