shell

one week information of alertlofile

Hi I want to view the ORA errors in alertlogfile of past 7 (monday-sunday)days, by writting in shell scripts. Can anybody help me. Thanks ...

For Loop in Shell Script - add breakline in csv file

Hello all, I wish to introduce a for loop in my shell script and I was hoping I could get some help with this. I am executing a command from a text file. I wish to execute each command 10 times and insert some stats into a csv file. After that command has been done, I want to start the next BUT put a line break in the CSV file after th...

COM-Interface for accessing file information (title, subject, author)?

Hi, On NTFS, any file can have extended file information based on an Alternate Data Stream. Explorer displays this as a tab in the file properties dialog. I am quite sure there is a COM-Interface for reading/modifying this information, but I seem to be unable to come up with the right terms for my search. Can anyone give me a short poi...

What career path should I take?

I have a decent experience with C++. I am a new linux user...just started with shellscripting. Besides this I am thinking of studing java (due to its platform independence). I am too confused about what to do, as the demand is changing too rapidly. I would like some help with what I should study. I am not interested in application deve...

How do I capture the output of a command to a file descriptor in Bourne shell?

The standard way to capture command output in Bourne shell is to use the $() syntax: output=$(mycommand) For commands that have a lot of output, however, this requires the shell allocate memory for the whole thing as one long string. I'd prefer to find something that does the moral equivalent of the Unix C function popen, to get a new...

How can I ssh directly to a particular directory?

I often have to login to one of several servers and go to one of several directories on those machines. Currently I do something of this sort: localhost ~]$ ssh somehost Welcome to somehost! somehost ~]$ cd /some/directory/somewhere/named/Foo somehost Foo]$ I have scripts that can determine which host and which directory I need t...

Is there a shell command to recursively give permission to directories and files?

Can someone please give me a recursive command that will go through a directory and make all normal files permission 644 and all sub directories 755? I am really getting tired of doing this manually every time I have to install something on my host. I don't know enough BASH (Shell?) command to do this. ...

Moving All Files From Directories One Step Up

Dear all, I have a directories that look like this fool@brat:/mydir/ucsc_mm8> tar -xvf *.tar 1/chr1.fa.masked 1/chr1_random.fa.masked 2/chr2.fa.masked 3/chr3.fa.masked 4/chr4.fa.masked 5/chr5.fa.masked 5/chr5_random.fa.masked 19/chr19.fa.masked Un/chrUn_random.fa.masked What I want to do is to move out all the "*.masked" files in th...

UNIX command to list folders with file counts

I want to get a list of folders at the current level (not including their subfolders) and simply print the folder name and a count of the number of files in the folder (preferably filtering to *.jpg if possible). Is this possible in the standard bash shell? ls -l prints about everything but the file count :) ...

Bash history re-runs: possible command to avoid using !bang! ?

Scenario: You are doing your daily Bash shell stuff. You want to run a previous command so you type: history | grep foocommand Then you get a list of all the foocommand stuff you did for however long your history has kept track, in a list like so: 585 foocommand --baz --bleet 750 foocommand | grep quux 987 history grep | fooco...

Grep Regular-Expressions on more lines

Dear all, I am writing a python program that is retrieving edifact log messages from a .gz file... An example of 2 logs are the following: 2009/03/02 12:13:59.642396 siamp102 mux1-30706 Trace name: MSG Message sent [con=251575 (APEOBEinMux1), len=2106, CorrID=000182C42DE0ED] UNB+IATB:1+1ASRPFA+1A0APE+090302:1213+0095JQOL2 2009/03/02 12...

ksh: how to probe stdin?

I want my ksh script to have different behaviors depending on whether there is something incoming through stdin or not: (1) cat file.txt | ./script.ksh (then do "cat <&0 >./tmp.dat" and process tmp.dat) vs. (2) ./script.ksh (then process $1 which must be a readable regular file) Checking for stdin to see if it is a terminal[ -t 0...

Default encoding for python for stderr?

I've got a noisy python script that I want to silence by directing its stderr output to /dev/null (using bash BTW). Like so: python -u parse.py 1> /tmp/output3.txt 2> /dev/null but it quickly exits prematurely. Hmm. I can't see the traceback because of course that goes out with stderr. It runs noisily and normally if I don't direct ...

Unable to call system commands and shell scripts from PHP Fedora 10

I am working on an application that runs locally on a Fedora 10 machine through PHP and Apache. It depends on a process that runs in the background. The higher-ups want to be able to start/stop/restart the process, through the browser. I was trying to get this to work by having PHP make calls to the system using exec() and shell_exec,...

Redirect stderr and stdout in a bash script

I want to redirect both stdout and stderr of a process to a single file. How do I do that in bash? ...

Can you prevent a command from going into the bash shell command history?

Is there a way to prevent a command from being added to the bash shell's command history? I would like to be able to prevent certain "dangerous" commands from being added to the history, such as "rm -rf ~/some/dir", so that it is not accessible to me by pressing the up-arrow to reach previous commands. In this way, it would not be poss...

How to rename files on a date base in the shell?

I'd like to rename some files that are all in the same directory. The file name pattern used is Prefix_ddmmyy.tex with a european date format. For the sake of readability and the ordering I'd like to rename the files in a pattern Prefix_yymmdd.tex with a canonical date format. Anyone ideas how I can do this automatically for a complete ...

Internet Explorer crashes when MSXML2::IXMLDOMDocumentPtr -> Release() is called

I am creating a shell extension in C++ (ATL 9) using Visual Studio 2008. The Shell Extension creates a global MSXML2::IXMLDOMDocumentPtr object m_XmlDoc in the module class. This m_XmlDoc is then used in the extension by all classes to read xml document. The problem that I am facing is with Internet explorer. When the Shell Extension is...

Convert Unix path to DOS path in a Korn shell script

I have a variable that stores a Unix path, for example: typeset unixpath=/foo/bar/ And I have to convert it to a DOS path using Korn shell scripting: dospath=\\foo\\bar\\ ...

Where to find example source code for a very simple linux shell

This would be great for educational purposes. Also a tutorial on subject would be nice. ...