How can I identify the last saved log?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can I identify the last saved log?
# 15  
Old 10-14-2008
Readers should be aware that if you have a really big directory with thousands of files, the shell expansion might fail or take a very long time. It may also be that the internal ls command runs out of memory, in which case, you can revert to the find method.
# 16  
Old 10-14-2008
Quote:
Originally Posted by treesloth
Sure, and if the original task were anything even vaguely approaching a heavy task, it would make a difference.

It would make much less difference if the task were a heavy one. If the external commands have a lot of work to do, the overhead in calling them is comparatively small.

If their task is lightweight, almost all the time they take is spent on creating a new process for each command rather than performing the actions they are asked to do.
Quote:
The original task was extremely lightweight. Many times virtually nil is, in this case, still very much virtually nil.

Three external commands is not virtually nil; the shell-only method is. Creating new processes is slow; using the shell's internal capabilities is fast.
# 17  
Old 10-14-2008
Quote:
Originally Posted by cfajohnson
Three external commands is not virtually nil; the shell-only method is. Creating new processes is slow; using the shell's internal capabilities is fast.
I don't know what kind of computer you're using; on mine, it's virtually nil for the task the original poster described. "Slow" is a relative term, and is ultimately a question of user acceptability. In cases where it's acceptable and I feel like it, I use external commands. The speed is quite acceptable, as I'm sure it would be for the original poster. However, your objections are duly noted and will be given the consideration they deserve.
# 18  
Old 10-14-2008
Quote:
Originally Posted by treesloth
I don't know what kind of computer you're using;

The kind of computer you or I have is irrelevent. When giving advice in a public forum, you may be talking to people using anything from a PII at 300MHz (or less) to the latest and greatest.
Quote:
on mine, it's virtually nil for the task the original poster described.

Virtually nil in realtime, for one instance, is still orders of magnitude slower than using the shell.
Quote:
"Slow" is a relative term, and is ultimately a question of user acceptability. In cases where it's acceptable and I feel like it, I use external commands. The speed is quite acceptable, as I'm sure it would be for the original poster.many

It is probably acceptable for one-time use at the command line.

In a script, where it may be executed many times, it may cause the script to be annoyingly and unnecessarily slow, particularly if the script contains many such inefficient constructs.
Quote:
However, your objections are duly noted and will be given the consideration they deserve.
# 19  
Old 10-14-2008
Quote:
Originally Posted by cfajohnson

...
I'm sure that's all perfectly well understood by all involved. It still doesn't matter in the case at hand. Sorry, I really just don't care about "orders of magnitude" (a dubious claim, besides) if the difference is imperceptible. However, the user has a variety of functional options to choose from, and reiterating your original criticism yet again (and again...) really doesn't contribute. I understood your point at the first, and I fully appreciate the difference in speed between internal and external commands. In this particular, lightweight, tiny case, I just don't care. I look forward to your virtually inevitable reply...
# 20  
Old 10-14-2008
Can we try for the SLOWEST command??
# 21  
Old 10-14-2008
Quote:
Originally Posted by otheus
Can we try for the SLOWEST command??
What, no rules? Can everything be prepended by 'sleep 600000 ; '? Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot access saved file

This may be wrong place to ask. I am currently modifying "stock" configuration file and making slow progress. Run into a snag - twice so far. I can work on the project switching from editing to run all day long, no issue. Next day i cannot access the file to run it. The file... (8 Replies)
Discussion started by: annacreek
8 Replies

2. Shell Programming and Scripting

Squares in saved code

can you help i am merging 2 files together and saving to a third file with awk and its working with this code awk 'OFS="";NR==FNR{a=$0;next} {print a,"\n","\b",$0}' file1 file2 > file3the problem is in file3 when its saved i get a small square at the start of every 2nd line (see picture) ... (6 Replies)
Discussion started by: bob123
6 Replies

3. UNIX for Dummies Questions & Answers

Script Not getting Saved

Hi , Script File Is Not Getting Saved This Are The Steps I Am Following For Saving And Executing A Script 1). vi ( To Open Vi Editor ) 2). vi filename ( vi firstprog.ksh) #!bin\kash date 3) !wq :( Saving And Quit) When I Am Saving The Scrpit I Am Getting The Below... (1 Reply)
Discussion started by: anudeepkumar123
1 Replies

4. Shell Programming and Scripting

Identify log files based on time stamp,zip and then copy..HELP

Hi All, PFB is a requirement. I am new to shell scripting. So plz help. It would be highly appreciated. 1. choose all the log files based on a particular date (files location is '/test/domain')--i.e,we should choose all the files that are modified on 29th November, neither 28th nor 30th 2.... (3 Replies)
Discussion started by: skdas_niladri
3 Replies

5. UNIX for Dummies Questions & Answers

where alias saved?

step 1 # alias alias cp='cp -i' alias l.='ls -d .* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias mv='mv -i' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' step 2 # cat ~/.bashrc # .bashrc (3 Replies)
Discussion started by: cqlouis
3 Replies

6. UNIX and Linux Applications

Bluefish: where are the preferences saved?

I have just tried out Bluefish as an alternative to my regular text editor. If I save the modified preferences and reboot, the preferences have to be reentered again. Does anyone know which file the preferences are saved in? The command find / -mmin -5 | grep bluefish yields zero hits. Thanks... (2 Replies)
Discussion started by: figaro
2 Replies

7. Shell Programming and Scripting

Can STDERR be saved to a variable

Guys i'm trying to save STDERR to a variable for a portion of my ksh script on solaris. I know i can create redirects to files as such: exec 4>/tmp/lava print "This will be saved to /tmp/lava and not screen"; >&4 print "This will be seen on screen" >&2 I want to save the STDOUT of a... (4 Replies)
Discussion started by: lavascript
4 Replies

8. UNIX for Advanced & Expert Users

Sudo file not saved

Hi all, I have edited my sudoers file. I am using visudo command I have added the following lines and saved the file. I am saving the lines as :wq But I am very amazed to see that these lines are not written in the sudoers file. I have retried the above process many times, when I... (0 Replies)
Discussion started by: Asteroid
0 Replies

9. UNIX for Advanced & Expert Users

only root's crontab gets not saved

Hi, Something funny is happening over here: when a regular user edits his cron-file (crontab -e) saves and exits vi the correct new cron-file gets installed and saved to disk. But if root does the same, vi saves it but if I then check the cron-file it has the previous contents! I did strace (==... (1 Reply)
Discussion started by: flok
1 Replies
Login or Register to Ask a Question