![]() |
copy/pasting from Terminal (i need answer...plz)
in fact im good in WIN OS but not very well in UNIX..
i have one question...i dont know if i can apply in UNIX or not.. Q: if i have a daily task..and this task going to copy paste some information from different terminals.. but not copy all contains of that terminal only some specific words or numbers in different lins..and pasted in one terminal can i do it :eek: ? if yes how:confused: ? thanks |
Need help from professional
in fact im good in WIN OS but not very well in UNIX..
i have one question...i dont know if i can apply in UNIX or not.. Q: if i have a daily task..and this task going to copy paste some information from different terminals.. but not copy all contains of that terminal only some specific words or numbers in different lins..and pasted in one terminal can i do it ? if yes how ? thanks |
You want to do this manually or scripted? Please be very specific, with examples.
|
Manually better dear,,,,
for example i have 3 terminals... A,B & C in terminal A , i want to copy a word in line # 12 start after 6 cursers and end after 11 cursers TO terminal C , in line # 1 ------------------------------------------------------- in terminal B ,copy a word in line # 110 start after 15 cursers and end after 20 cursers TO terminal C , in line # 2 i hope it is clear what im lookingfor thanks |
Well, 100% manual is stupid-simple: select text in Terminal window 1, Command-C, select Terminal window 2, Command-V.
However, assuming that by "Terminal" you really mean "file", you can get the lines extremely easily with : sed -n '12p' file1 >> file3 sed -n '110p' file2 >> file3 There are several ways to get the individual characters, but I'm still not sure what you really want to do. Please post real examples, with content, and specify wether the numbers will or will not change. Unix has extremely powerful text and character matching functions, but they need to be told very specifically what to do. |
I appreciated your helping..may my request not very clear couse im new in UNIX..
i will sort im requests: 1) if i have big text file, how can i show the line's numbers. 2) (sed -n '12p' file1 >> file2) ....only copy line#12 from file1 to file2 can i copy more than one line from file1 to file2 in one command. 3) Thanks |
1) there are many ways of getting information without knowing exactly what line number. Explain in great detail what you need to do, with some examples. Like 20 lines from the file including the one you want.
2) sed -n '12,20p' file1 will copy lines 12 to 20. If you want an assortment of lines, how do you decide which ones? Again, post examples. |
Quote:
But the following Perl one-liner will show the contents of a file "foo" with each line preceded by its line number: perl -pe 's/^/$. /' foo Quote:
|
My dear..
i have a file with around 900 lines..i want only some of lines to copy in other file. it is hard to count the lines in that big file.. For example.. in that big file i need to copy line #28 #200 #498....and so on, but they are fixed.. the data will changed daily but in same lines..thats why i need to know lines number. |
Quote:
perl -ne 'print if $.==28 || $.==200 || $.==498' foo |
perl -ne 'print if $.==28 || $.==200 || $.==498' foo
u still missunderstand me.. 28 200 498 just an example.. friends.. i have big file have 900 lines..i want some in between lines..i dont know that line's number..and hard to count it also.. hope u get it.. thanks |
How do you choose the lines to copy?
Once again, post examples and explain how you choose. Show us lines 28, 200, 498 and 10 other lines you don't want. |
i have big file(file1) with many many lines
for example to use (sed -n 'line#p' file1 >> file2) i know what i want to copy..but i dont know the (line#) beouse it is very big.. My question .. How can i know that line number...? ----------------------------------------------- if my big file have 900 lines there is any method to dispaly lines number like 1 2 3 4 . . . 900 |
We think that you are doing this the hard way.
Post examples OF THE LINES you want to copy, not just the numbers. Tell us exactly why those lines are important, and why other lines are not important. You say "I know what I want to copy". Share that knowledge. |
Quote:
|
my version is ( digitel UNIX V4.0f) and i tried your command in post 8,,
but it didn't work.. and gave a message that it can't read ( perl) command. and i try to get it by using ( find . -name perl) but no thing come |
Quote:
It seems that your version of Unix doesn't come with Perl so you'd need to install it. |
u r right friend..i try (perl) with Mac SO and it work well..
but my job should be with UNIX v(4 to 5.6) so where can i get my intention...? any good furoms or any one can serving me in this... your help is highly appreciated Thanks |
perl is only one tool of many.
and `find . -name perl` will only work properly from the / directory. try: find / -name 'perl' However... We have asked several times for examples of the data you are working with. No forum will be able to help if you don't explain clearly what you are doing. |
fine...
i have daily job on UNIX server..im job is to check the memories status of 20 Work Station which connected to that server.. all this Works Station memories status are in one big terminal. that mean i only need 20 lines of this big terminal.. what im lookingfor is to take these 20 lines in new terminal to make my job more easy. |
I understood that part a long time ago.
Post the 20 lines you want, along with 20 lines you don't want, and tell me how you decide. |
for example the terminal contains of any text message :
and i want only the bold lines ------------------------------------------------------------------------- Abu Dhabi: The Middle East and North Africa (Mena) is set to play a decisive role in global crude oil supply as its market share is expected to swell to a record 44 per cent in 2030, according to an official Arab study. Saudi Arabia, the world's biggest exporter, could lift output to a staggering 18 million barrels per day, while war-battered Iraq could climb to eight million bpd. The UAE and Kuwait could lift crude output to an average 5 million bpd each, according to the latest bulletin from the 10-nation Organisation of Arab Petroleum Exporting Countries (Oapec).The projected capacity of nearly 36 million bpd for those four producers is more than double their current output of around 17 million bpd, including nearly 10.5 million bpd for Saudi Arabia. Their combined output, along with Iran's production, could surge to 44 per cent of the world's supply in 2030 from 35 per cent in 2004, the bulletin said. "Economic forecasts and research centres indicate that producing countries in the Middle East and North Africa will play a vital role in meeting world energy growth in the coming decades. They cite several factors including the vast size of their proven oil (and gas) reserves and their low production costs," the study said."Saudi Arabia in particular will play a pivotal role in meeting future oil requirements owing to its sizable production capacity." domestic consumptionThe study figures showed Saudi crude production would grow to nearly 18 million bpd by 2030 while Iraq's output could rise sharply if the "appropriate investments are undertaken and good progress is made in the country's political and constitutional process."Iraq's production could reach about eight million bpd by the end of 2030. While the UAE and Kuwait are predicted to achieve 5.1 million bpd and 4.9 million bpd respectively.As a result, the Middle East (including Iran) and North Africa will account for a record 44 per cent of the world's crude oil production by 2030, compared with 35 per cent in 2004," the study said. It noted that despite the forecast, increases in the region's domestic energy consumption are in keeping with the high economic and population growth rates, production growth will exceed its consumption growth. -------------------------------------------------------------------------- this is an example,, but the real termimal more big..the blod line what i want and skip the other NOTE: the blod line is updated daily so how can i know the lines numner |
So you are dealing with news articles. There are a few problems with what you posted.
1. Why do you want those particular lines? They don't contain any critical information, do not summarize the article, and put together do not make sense. 2. The bold parts are not really lines, but part of a paragraph. 3. You say the bold lines are updated daily. The other lines are not?? I don't think so. Changing only the bold lines in your example would not make any sense. The entire article would be rewritten rather than changing specific lines. |
my friend my question very simple and clear..
HOW can i show the lines number for any terminal..??!! i can by: vi (file name) then perss (Ctrl + g) this is fine..but show u the line number on the corser so can i show all lines number on one time. |
Hayne answered that question in post #8. How you show a line number in a text editor is dependent on the text editor. Read the appropriate manual page for the command.
If you won't put up the real data, along with your reasons for choosing the lines, then we can't help you. |
in fact i can't show the real data becouse it is so secure,,,,
but thanks for your insist for helping.. im sure i will need u again thanks |
Quote:
|
ugg, people just need to learn how to program
|
Quote:
cat -n file_name to get the line numbers. Mrjas I guess what everyone is asking you, is how do you know which phrases out of the file you want. You apparently are trying to write a script to extract the phrases out of the files. Do you want to use the same script on different occasions when the data changes, or do you want to write different scripts everytime the data changes. Will the phrases you want be in the exact same location, when the data changes? -- |
finally..
that's what im lookingfor.. thank you all and thank you cb 2005 |
I doubt that would work.
If you run it on your Example, it would only number 5 lines as existing. |
No dear your doubt not right..
this command work well..i tried it |
So the example was nothing like the text you where actually using it on??
|
| All times are GMT -5. The time now is 05:33 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.