General :: Multiple Files In Vi
Oct 6, 2010I have opened a file using vi i.e. abc.txt now I have given : new xyz.txt
two files now opened in the vi My problem is i can scroll through abc.txt only. how to scroll the xyz.txt also
I have opened a file using vi i.e. abc.txt now I have given : new xyz.txt
two files now opened in the vi My problem is i can scroll through abc.txt only. how to scroll the xyz.txt also
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
How can you create a script to move or copy files from a main directory into multiple directories below the main directory.
View 7 Replies View RelatedI am fairly new to Linux and was needing some help on a comparing more than 2 files. I am try to come up with something that would compare at least 10+ different files to a master file and give me an output of what is missing.
Example would be: a.txt, b.txt, c.txt, d.txt compare each of them to the master.txt file, than output the missing text for each file into new file.
I came across comm and diff commands, am I looking in the right place or is there a much easier way of doing this?
I have mulitple files that i need to be altered...is there a way to do so with out having to enter each and every file and do so?
View 3 Replies View RelatedI would like to retrieve the lists of multiple files at one go. Each file is big size so wget command is too slow to download all 14 files.
[URL]
I have a directory with hundreds of html files.
For all the files I have to:
- delete all the row from the beginning of the file to the sentence "<img src="immagini/_navDxBottom.gif" />".
- delete all the rows from the sentence "<br clear="right" />" to the end of the file.
How can I do that?
How to open multiple files with tab?
View 2 Replies View Relatedhave a large amount of 7z files in multiple folders which I need to extract.The directory structure is like this:
/main-folder/
multiple subfolders/
1 or more 7z files per subfolder
I would like to get the output of this action in one separate folder, all together in 1 folder.How can I do this?
I often use the rpl command to make changes to multiple html files at once. For example:
rpl -R '<br />' '<br /><br />' mydirectory However, I haven't been able to figure out how to change multiple lines. For example, let's say I want to change all occurrences of :
<br />
<br />
to:
<br />
I've tried
rpl -R '<br />
<br />' '<br />' mydirectory
but that didn't work. how to do this with rpl or some other way?
How do you join multiple MP3 files into one? "cat" and "mp3wrap" are no good as they produce non standard MP3 files. I know I can use audacity, but when you have 1000's of MP3 files to join into one, it takes too long.
View 2 Replies View RelatedI have 100 files: cvd1.txt cvd2.txt ... cvd100.txt
How to gzip 100 files into one .gz file so that after I gunzip it, I should have cvd1.txt, cvd2.txt ... cvd100.txt separately?
I am having a problem unzipping multiple files at 1 time.
Proper unzip command that will:
1) extract the file from the zip.
2) remove the zip file.
All my zip files start with SB and end with .emi.zip
SB*.emi.zip
how to run a command on all files with the same extension in a directory like this:
Code:
tex breqn.dtx; tex empheq.dtx; tex flexisym.dtx; tex mathstyle.dtx; tex mathtools.dtx; tex mhsetup.dtx; tex xfrac.dtx;
but in a simpler manner? I found this: Code: find . -type f -name *.dtx -exec tex {} ; but isn't there something simpler?
I would like to find all the files that contains the strings I'm searching.
For example (it's just an example), I would like to search all the files in "/etc" that contains "eth0" and "us", whatever where are located those 2 strings, the important is that the 2 strings are in the files listed.
It would be something like a "grep -lr 'eth0' *" and "grep -lr 'us' *" but in one time/command, so that I don't have to make a comparison of the 2 list of files resulting from the 2 "grep" commands given higher.
I have a file with 5 columns. Column 4 contains numbers.Is it possible to split the file into multiple files using a condition for the contents of column 4 i.e if column 4 contains a value between 0-10 then print the lines to a new file called less_than_10.txt
View 1 Replies View RelatedWhen we view multiple files using less, how to go on to the next file? I gave these two commands:
Code:
[root@localhost log]# ls -lt boot.log*
-rw------- 1 root root 0 Apr 11 04:02 boot.log
-rw------- 1 root root 0 Apr 4 04:02 boot.log.1
-rw------- 1 root root 0 Apr 1 19:14 boot.log.2
-rw------- 1 root root 0 Mar 21 04:02 boot.log.3
-rw------- 1 root root 0 Mar 14 04:02 boot.log.4
[root@localhost log]# less boot.log*
This is what I got:
Code:
boot.log (file 1 of 5) (END) - Next: boot.log.1 <RETURN>
(END) - Next: boot.log.1
I could not view boot.log.2.
Combine multiple text files into one text file?
View 5 Replies View RelatedI have 60+ directory's each containing multiple .doc files. I need to move them to a single directory and keep their file name intact. I don't think cp will do that with out listing all the file names. I was thinking of something like: cp -r /dir/*.doc /newdir . Or should I use a combo like find -type *.doc|cp /newdir?
View 5 Replies View RelatedI'd like to extract a single column from 5 different files and put them gether in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is:awk 'NR==FNR{a[NR]=$2; next} {print a[FNR], $2}' file1 file2I added the file3, file4 and file5 at the end, but it doesn't work. Does anyone know what do I have to do?
View 5 Replies View RelatedI am using ubuntu 8.04 and have a separate home partition. While setting it up I had a few failures and was left with several directories containing many hidden files which I can't seem to delete. The man pages for 'rm' didn't seem to provide the answer either.
Is there a flag or escape sequence that will allow 'rm' to delete these files?
I have four hard drives in my machine with several different O/S installs.
I have a couple of Linux distros, win xp, and win 7.
I'm wanting to view all my files in a file manager such as Dolphin but it only shows the Pardus that I am running and the other Windows installs.
My other Linux installs do not appear.
I've recently switched from Windows where I am used to seeing all the different Windows installs on windows explorer.
Is this not possible to do in Linux?
I am wanting to move some files from one system to the other and this is frustrating not being able to see them.
I'm new to commandline, and I'd like to:
$mencoder -ffourcc DX50 -oac mp3lame -ovc lavc about 10 files...
How to write that?
I want to merge columns (selectively) from several files and create a new file with the merge output. I saw some suggestions to use pr/paste to join the columns and then awk to pick-up the columns.
Code:
pr -m -t -s file1 file2 | gawk '{print $4,$5,$6,$1}'
But I have hundreds of files and I cannot manually pick up columns using awk as given in
[code]....
Vim -o file1 file2 opens two files splitting the window horizontally. How to do that vertically?
View 7 Replies View RelatedLong story short, I got a folder with nearly 800,000 php files. I would like to search each file for a string and if it exists in that file, the file gets copied to another directory. Is this possible from the terminal? So far I got: grep -i -n -r 'ppr-1792' * | cp $1 move_to_here
But this obviously doesn't work. $1 needs to be the file name that contains matching text.
I have a directory (Linux user) with a number of files which contain an added [!] to the end of each file name so that each file reads out as:
foo something [!].zip
bar something [!].zip
helloworld [!].zip
etc.
What is the quickest way to batch rename these to remove the ending [!] character combination from these file names?
Suppose I have a tree structure like this:
/home/mahmood/sim/a/b/file1.cpp
/home/mahmood/sim/a/b/file2.h
/home/mahmood/sim/a/c/file3.txt
/home/mahmood/sim/d/file4.txt
How can I copy all of them to /home/mahmood/sim. So that when I run "ls" in /home/mahmood/sim, I see all files:
file1.cpp
file2.h
file3.txt
file4.txt
Can 'cp' search for all file and copy them in another folder?
After hours (literally) of searching the web and reading man pages, I think I've come up with the following:Code:find . -exec grep 'path/to/file' -print | xargs -0 -I new_path mv {this is where I get confused}So my code above is incomplete, obviously. In order to finish replacing the string, I need to mv the new file into the old file's spot. How do I do this, by incorporating it into my line of code?
View 14 Replies View RelatedRecently I installed Dropbox on a server to do file synchronization and it added " (Case Conflict 1)" to a whole bunch of my files! I realize now that it was caused by case insensitivity but I'm still left with hundreds of files that are in this renamed state. Is there a script in Linux that would allow me to recursively go through the directories and strip out this string?
i.e.
a (Case Conflict 1).jpg --> a.jpg
/myfolder/abc (Case Conflict 1).doc --> /myfolder/abc.doc
/myfolder/subfolder/mydoc (Case Conflict 1).pdf --> /myfolder/subfolder/mydoc.pdf