gudii9
asked on
copy paste from one file to other file
Hi,
In unix using vi how do i copy paste from one file say abc.ccfg to xyz.ccfg.
in windows i simply say on abc.ccfg select all then control c then go to xyz.ccfg say control v .
Thats all i have to do.
VI editor is something i hate.
not at all use friendly.
even moving cursor is big thing there.
any good shortcuts and tips, links on using vi.
In unix using vi how do i copy paste from one file say abc.ccfg to xyz.ccfg.
in windows i simply say on abc.ccfg select all then control c then go to xyz.ccfg say control v .
Thats all i have to do.
VI editor is something i hate.
not at all use friendly.
even moving cursor is big thing there.
any good shortcuts and tips, links on using vi.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I guess the whole point to do this on a command line.
If it's all command line, then select the text you want to cut with yy or dd. Open the 2nd file within vi/vim with :e /path/to/2nd/file. Then you navigate to the location and paste p the contents.
ASKER
is winscp tool is bad to edit and copy paste? my friend says it corrupts the unix files and never use winscp? is that is correct?
winscp securely copies files from one location to another.
As far as editing goes it invokes your default text editor. Your mileage will vary if course. Always use vim to stay on the safe side.
As far as editing goes it invokes your default text editor. Your mileage will vary if course. Always use vim to stay on the safe side.
ASKER
To extract lines 2 to 10 useyou mean copy line 2 to line 10 of filein.txt pasted into fileout.txt?
sed -n 2,10p filein.txt > fileout.txt
if i wanted them to be pasted at line 20 of fileout.txt is there is a way??
Something like this can be down with either sed or awk
https://stackoverflow.com/questions/6537490/insert-a-line-at-specific-line-number-with-sed-or-awk
https://stackoverflow.com/questions/6537490/insert-a-line-at-specific-line-number-with-sed-or-awk
ASKER
Do you have a GUI with 2 vi windows open?how to open two vi windows.
lets say i have two files called xyz and abc both under same directory same user.
how to open them in 2 GUI windows using putty or winscp or mputty etc
That depends on what sort of Desktop Manager you have. Usually launching the terminal application twice is enough.
To open a new duplicate putty session:
Click on the top left corner of your Putty WindowA dropdown menu will appear
Select Duplicate Session (If you used SSH Keys and have it loaded in a running PAGEANT, you should automatically log in.)
Enter your credentials. <-- Skip if you use keys and PAGEANT (putty agent for storing ssh key credentials)
Open your second editor (vi) with the new file
To cut and paste between putty windows:
Select text in the first window. <- Just select it. You don't need to press control c.Got to the 2nd window and have your editor in Edit Mode with the text cursor in the correct position.
Paste the text by right clicking into the Putty Window. <- Just right-click. You don't use Control v.
Putty cut and paste defaults to age old unix/linux X11 style cut and paste. This is what old timer X11 users are used to. The mouse was an afterthought to Microsoft and wasn't even required to be include on systems until Windows 95. That's why you can navigate Windows with basically just the keyboard, although the newest incarnations make some of the navigation much more painful and tedious. With Unix X11 and Mac OS X, you must have a mouse or you can't navigate to certain parts of the GUI interface.
Using Xming
You can install Xming and Xming-Fonts to run X11 on your Windows system to allow X11 Windows to run through your system. You'll have to enable X11 tunneling in Putty and run Xming in the background. You can then open new terminals from within Putty and run any GUI utilities. I don't recommend this if the connection is slow. It works much, much better if the "remote" system is on a local subnet.
Any updates? Do you need more help on the subject?
ASKER
To open a new duplicate putty session:
Click on the top left corner of your Putty Window
A dropdown menu will appear
Select Duplicate Session (If you used SSH Keys and have it loaded in a running PAGEANT, you should automatically log in.)
Enter your credentials. <-- Skip if you use keys and PAGEANT (putty agent for storing ssh key credentials)
Open your second editor (vi) with the new file
To cut and paste between putty windows:
Select text in the first window. <- Just select it. You don't need to press control c.
Got to the 2nd window and have your editor in Edit Mode with the text cursor in the correct position.
Paste the text by right clicking into the Putty Window. <- Just right-click. You don't use Control v.
Putty cut and paste defaults to age old unix/linux X11 style cut and paste. This is what old timer X11 users are used to. The mouse was an afterthought to Microsoft and wasn't even required to be include on systems until Windows 95. That's why you can navigate Windows with basically just the keyboard, although the newest incarnations make some of the navigation much more painful and tedious. With Unix X11 and Mac OS X, you must have a mouse or you can't navigate to certain parts of the GUI interface.
how to do if i have to copy paste from my friend directory.
how to do if i have to copy past from say production environment server to integration environment server both running at different IP?
can i practice that here
https://www.tutorialspoint.com/unix_terminal_online.php
??
Run the Terminal application in separate tabs or windows and use normal cut and paste feature.
ASKER
0k
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here goes the reason why bing or google was used instead of google or bing:
1. Google
2. youtube
3. bing
>> can i practice that here
Download http://www.cygwin.com/setup-x86_64.exe or http://www.cygwin.com/setup-x86.exe (64 bit or 32 bit windows:
setup-x86_64.exe --no-admin
enable the package for vi and install that.
Always install during morning (IST) time due to network speed.
echo "google bing" | /usr/bin/tr " " "\n" |/bin/sort -u
bing
google
However bing informing:1. Google
2. youtube
3. bing
>> can i practice that here
Download http://www.cygwin.com/setup-x86_64.exe or http://www.cygwin.com/setup-x86.exe (64 bit or 32 bit windows:
setup-x86_64.exe --no-admin
enable the package for vi and install that.
Always install during morning (IST) time due to network speed.
@Murugesan Nagarajan
Expect me to object to all you self closing requests going forward because you keep assigning yourself more points after jumping into the discussion months later. This question should have been closed earlier by @gudi9. Since you're self assigning points, you can't know whether your answer is actually more valuable to @gudi9. If you're going to unfairly assign points, I'll continue to object to every one of your closures that I see. Your answer does not add much additional value to the earlier answers and therefore does not deserve points.
Expect me to object to all you self closing requests going forward because you keep assigning yourself more points after jumping into the discussion months later. This question should have been closed earlier by @gudi9. Since you're self assigning points, you can't know whether your answer is actually more valuable to @gudi9. If you're going to unfairly assign points, I'll continue to object to every one of your closures that I see. Your answer does not add much additional value to the earlier answers and therefore does not deserve points.
Point grabbing. New answers months later do not add substantial value to deserve the bulk of the points.
Hi serialband,
#a42334907 for:
>> VI editor is something i hate
>> In unix using vi how do i copy paste from one file say abc.ccfg to xyz.ccfg.
from author
This is meeting the requirement.
#a42334914 for:
>> any good shortcuts and tips, links on using vi
from author
#a42238710 for:
GUI with 2 vi => referring usage of applications /usr/bin/gedit
#a42334914 for:
:e /path/to/2nd/file
>> keep assigning yourself more points
No, since I have obtained all the points at experts exchange from 2004.
Hence closed as per the given points.
Regards,
Murugesandinesh
#a42334907 for:
>> VI editor is something i hate
>> In unix using vi how do i copy paste from one file say abc.ccfg to xyz.ccfg.
from author
This is meeting the requirement.
#a42334914 for:
>> any good shortcuts and tips, links on using vi
from author
#a42238710 for:
GUI with 2 vi => referring usage of applications /usr/bin/gedit
#a42334914 for:
:e /path/to/2nd/file
>> keep assigning yourself more points
No, since I have obtained all the points at experts exchange from 2004.
Hence closed as per the given points.
Regards,
Murugesandinesh
Hence proposed answer will be accepted and assisted using:
a)
either by gudii
Need accepted/assisted from gudii.
b)
if not accepted/assisted for 14 days (to use /usr/bin/make clean)
Accepted answer: 350 points for Murugesan Nagarajan's comment #a42334907
Assisted answer: 150 points for serialband's comment #a42238710
Assisted answer: 150 points for serialband's comment #a42239951
Assisted answer: 350 points for Murugesan Nagarajan's comment #a42334914
a)
either by gudii
Need accepted/assisted from gudii.
b)
if not accepted/assisted for 14 days (to use /usr/bin/make clean)
Accepted answer: 350 points for Murugesan Nagarajan's comment #a42334907
Assisted answer: 150 points for serialband's comment #a42238710
Assisted answer: 150 points for serialband's comment #a42239951
Assisted answer: 350 points for Murugesan Nagarajan's comment #a42334914
Close with no points assigned if no comment from original poster.
Hi Dmitri Farafontov,
>> Close with no points assigned if no comment from original poster
This needs to be followed, under following conditions
1. no answer was given
2. not tested
3. Search using experts exchange or google/bing should not give this page.
>> Close with no points assigned if no comment from original poster
This needs to be followed, under following conditions
1. no answer was given
2. not tested
3. Search using experts exchange or google/bing should not give this page.