Operating System - HP-UX
1833692 Members
4763 Online
110062 Solutions
New Discussion

Re: cut/paste from logfiles...

 
SOLVED
Go to solution
James Ellis_1
Super Advisor

cut/paste from logfiles...

As I am looking at the log files, I want to cut/paste a section of the log file. The menu bars via hummingbird/xwindows where I view the log files, don't seem to have this feature. Is there any way I can cut/paste a section of a log file, or highlight the section I want to print and send it to the printer? I cannot seem to do this and this would be very helpful if I can do this. Any suggestion appreciated.

Thanks.
"In the middle of difficulty lies opportunity" -Einstein
18 REPLIES 18
Pete Randall
Outstanding Contributor

Re: cut/paste from logfiles...

James,

We use Reflections rather than Hummingbird, but I think it should be basically the same. The cut and paste is part of CDE, the question is how does your emulation implement it. For us, it's right mouse click to cut, then right and left mouse click (simultaneously - it takes some getting used to) to paste.

Give that a try.


Pete


Pete
Zigor Buruaga
Esteemed Contributor

Re: cut/paste from logfiles...

Hi,

I use Hummingbird Exceed and can copy/paste.
If you open a "dtterm" terminal emulation and i.e. run "cat /var/adm/syslog/syslog.log" you should be able to select lines and copy/paste them ( from the menu bar and from right-click ).

Regards,
Zigor
James Ellis_1
Super Advisor

Re: cut/paste from logfiles...

Thanks for your reply. I can highlight the text, and click on the Edit menu bar and click Copy, but pasting this in something like Word does not work. Or if I do the above, and want to send it out to the printer, how do I do this? I'll try it the way you suggested and see if it works. Thanks.
"In the middle of difficulty lies opportunity" -Einstein
Elena Leontieva
Esteemed Contributor
Solution

Re: cut/paste from logfiles...

This is what works for me:

In a terminal window I highlight the text, go to exceed bar on the very top of the screen, click on it and choose Edit -> Copy X selection -> To Clipboard

Then you can paste it anywhere.

Elena.
Zigor Buruaga
Esteemed Contributor

Re: cut/paste from logfiles...

Hi,

Try opening "Text Editor" in Exceed and pasting on it.
Then, in the menu bar choose "Print" option ... or save it to a file.

Regards,
Zigor
Mark Greene_1
Honored Contributor

Re: cut/paste from logfiles...

You can make this automatic by doing the following:

- From the exceed icon in the taskbar, right-click and select tools

- in the pop-up menu select Configuration.

- in the new window select X Selection.

- in the new pop-up, make sure PRIMARY is what is selected from the drop box

- check the boxes for Auto Copy and Auto Paste

- Click OK

- Close the Configuration window

You should now be able to highlight the text you want and automatically paste it into any other windows app.

HTH
mark


the future will be a lot like now, only later
Mark Greene_1
Honored Contributor

Re: cut/paste from logfiles...

My mistake, instead of PRIMARY (what it defaults to), select CLIPBOARD.

mark
the future will be a lot like now, only later
curt larson_1
Honored Contributor

Re: cut/paste from logfiles...

if your login in via XDM throught the gui i'm not to sure you can cut and paste to window apps, although you can cut/paste to other windows in CDE. But, if you login via an rexec process (telnet, rlogin, etc) to bring up a terminal window then you can cut/paste to window apps
James Ellis_1
Super Advisor

Re: cut/paste from logfiles...

Well, after trying many ways, Elena's way works. However, this does not allow me to cut/paste more than the screen shows. I want to copy all of the errors to a file and save it, and send it to HP. I am having SCSI/lbolt errors and need to get this fixed before I travel next week for two weeks (work related). So for those of you who know how to do it with Elena's way, is there a way to copy more than a screenful? Thanks.
"In the middle of difficulty lies opportunity" -Einstein
Mark Greene_1
Honored Contributor

Re: cut/paste from logfiles...

The version I'm on (6.2.0) will only do one screen at a time.

mark
the future will be a lot like now, only later
V. Nyga
Honored Contributor

Re: cut/paste from logfiles...

Hi,

for this you could work with grep:
grep 'string' file > new_file

string is what you want, for ex. error
file is your log-file
new_file is the new file with all lines with 'error'

If there are lines before or after an error I'm looking for a time stamp which I use as the string to search for.

Regards
Volkmar
*** Say 'Thanks' with Kudos ***
Elena Leontieva
Esteemed Contributor

Re: cut/paste from logfiles...

If there is a way to copy more than a screenfull, I would like to know how. To mail larger files I ftp them to my PC. :(

Elena.
Wouter Jagers
Honored Contributor

Re: cut/paste from logfiles...

I try to stay away from X as much as possible.. let's try it in shell :-)

First, you have to find out the line numbers of both the starting and ending lines you want. If you know the line numbers you can skip the next two paragraphs.

If the file is small enough to open with vi, you can check the line numbers by issuing :set number , which will show you line numbers in your file.

Should the file be too big for opening with vi, you can find out the line numbers by issuing this awk command:
awk '{print NR,$0 }' filename | more

Once you have the numbers of the starting and ending lines, you can 'sed' them out of the file. For example, for lines 48 to 56:
sed -n -e '48,56p' filename

The output from that command will be your 'interesting' section. Pipe it to mailx or redirect it to a file, it's now yours to play with !

Regards
Wouter
an engineer's aim in a discussion is not to persuade, but to clarify.
Wouter Jagers
Honored Contributor

Re: cut/paste from logfiles...

However, should you be working on a Mickeysoft workstation, you could easily use any Windows terminal program that maintains a buffer, cat the file, scroll up and use your Windows copy&paste functions.

It's the one thing I use Microsoft software for ;-)

Greets
Wouter
an engineer's aim in a discussion is not to persuade, but to clarify.
Ronelle van Niekerk
Regular Advisor

Re: cut/paste from logfiles...

James,

I used Hummingbird quite a while ago and was going to give you Elena's answer - the only way to do it.

I can't remember if I ever did it but I think there is a scroll bar option. Enable the scroll bar option, do a cat pof the file, scroll to the top of the file and you may be able to high;ight the entire file.

Just a thought.
rm -r /it/managers
Zigor Buruaga
Esteemed Contributor

Re: cut/paste from logfiles...

Hi,

Open the "Text Editor", then click "File" --> "Open" and browse to your log file.
Once opened, select "Edit" --> "Select All".
Then, copy and paste following the Elena??s suggestion ( or save to file ).

This works for me ( Exceed v6.0.2 ).

Kind regards,
Zigor
Elena Leontieva
Esteemed Contributor

Re: cut/paste from logfiles...

Zigor,

You are right, this is the way to go if you can not highlight all you need in a terminal window.

Thank you very much for the enlightment!

Elena.
Rob_132
Regular Advisor

Re: cut/paste from logfiles...

From a vi "bigot's" perspective:

vi
:set num
/
(note start line number)
G
(go to bottom of file)
?
(note end line number)

:, w!

***

also tells you line number of cursor, so that can be used instead of ":set num" (.....5 less keystrokes....)

Enjoy!