Need Linux equivalent for UNIX


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Linux equivalent for UNIX
# 1  
Hammer & Screwdriver Need Linux equivalent for UNIX

I have a folder called "log" which has a few sub-folders say "fda" "fd7" "fdd" "fd6 .... "

I wish to fire the below command inside each subfolder starting with the folder with the latest time stamp.
Code:
 
grep "$greptime.*exit" Prod.$(hostname).log | grep $fdrdate_new

If the seach did not yield any results it should then seach inside the second latest sub folder till it reaches the oldest sub folder or if it finds the string.

Can you please suggest how can i on Linux.
# 2  
Just the same way as on Unix.
afaik, both are POSIX compilant, and as long you use the same shell, it is, beside folder locations (simple speaking), 100% identical.

Scripting per-se, doesnt change beween unix, linux or bsd.
# 3  
Quote:
Originally Posted by sea
Just the same way as on Unix.
afaik, both are POSIX compilant, and as long you use the same shell, it is, beside folder locations (simple speaking), 100% identical.

Scripting per-se, doesnt change beween unix, linux or bsd.
I dont know how-to on Unix either. All i can think of is we have a for loop that breaks off as soon as the result is found. Can you help.

Last edited by mohtashims; 05-09-2015 at 03:27 AM..
# 4  
After more than 375 posts, I am very disappointed that you still don't have any idea how to write a simple for or while loop using a standard shell! And, the title of this thread doesn't give any indication of what you are trying to do.

You were also very skimpy with details about whether or not all of your directories will actually contain a log file for the desired hostname, how the variables hostname, fdrdate, and greptime are set, nor where the log directory is located.

Maybe the following will give you a starting point:
Code:
#!/bin/ksh
#set -xv
basedir="/path/of/log"
fdrdate_new=${1:-fdrdate_new default value}
greptime=${2:-greptime default value}
hostname=${1:-default hostname}
looking=1
cd "$basedir"
ls -td * | while [ "$looking" ] && read fn
do
	if [ ! -d "$fn" ]
	then	continue
	fi
	if grep "$greptime.*exit" "$fn/Prod.$hostname.log" | grep "$fdrdate_new"
	then	echo "Match found in file: $fn/Prod.$hostname.log"
		looking=
	else	echo "No match found in file: $fn/Prod.$hostname.log"
	fi
done
if [ "$looking" ]
then	echo "No match found."
	exit 1
fi

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #476
Difficulty: Medium
A Zettabyte (ZB) is 1,180,591,620,717,411,303,424 bytes.
True or False?

10 More Discussions You Might Find Interesting

1. Red Hat

NFS_v4_fail_over_timeout equivalent in Linux

Hi, I need to mount a replicated nfs4 export on a number of AIX and Redhat hosts. To get the failover on the clients working smoothly, I need to change certain values on the AIX boxes like nfs_v4_fail_over_timeout, timeo and retrans values. Since I have no clue about Linux, I am not quite sure... (1 Reply)
Discussion started by: zxmaus
1 Replies

2. Linux

/etc/netmasks equivalent in linux

Hi Guys, I am used to configuring DHCP on Solaris and foreach subnet added I place a corresponding entry in /etc/netmasks. I am now looking at configuring DHCP on linux, is there an equivalnet entry required somewhere or is this not needed in linux Thanks (3 Replies)
Discussion started by: eeisken
3 Replies

3. HP-UX

UNIX VI editor equivalent of LINUX

Hi All, I am comfortable working in LINUX and need equivalents for HP-UX for below mentioned, 1. We use TAB key to expand/reveal a name in LINUX. Is there any way to make this work for UNIX, where it is double escape. 2. Also can we use make use of left,down,up,right keys instead... (3 Replies)
Discussion started by: pradebban
3 Replies

4. Programming

WSAAsyncSelect equivalent for linux

Hello, I'm writing a multi-threaded socket server in C++ and I needed something like wsaasyncselect to handle messages like fd_accept, fd_read, fd_connect, fd_close. Thanks in advance. (2 Replies)
Discussion started by: lucastonon
2 Replies

5. Linux

Linux equivalent for...

I moved to a Linux system from Windows a few months ago. Most of the programs I had been using were already native to Linux (Firefox, the GIMP, Pari, etc.) and most others I found a close enough program (Crimson Editor -> gedit, Visual Studio -> KDevelop, Primo -> Morain's ECPP). Now I'm down... (1 Reply)
Discussion started by: CRGreathouse
1 Replies

6. Linux

Mksysb Equivalent For Linux?

I have experience with making bootable images of AIX systems using mksysb and wondered if there was some type of equivalent software for Linux. Or perhaps some of the folks here have alternatives or unique ideas for how they are backing up their Linux systems enabling them to recover them as... (13 Replies)
Discussion started by: scotbuff
13 Replies

7. UNIX for Advanced & Expert Users

ACF2 equivalent in Unix or Linux ?

In IBM Mainframe they have something called ACF2 rule which is essentially used to control the dataset access. It is kind of a list-based access control for mainframe datasets. Is there anything equivalent to ACF2 available in Unix ? Thanks Rabi (1 Reply)
Discussion started by: indra_saha
1 Replies

8. UNIX for Advanced & Expert Users

Equivalent for iostat -e in AIX HP-UX Linux

iostat -e gives the soft, hard and transport error information in Solaris. What is the equivalent command in the other flavors of Unix AIX HP Linux. Thanks Prasi (1 Reply)
Discussion started by: prasi_in
1 Replies

9. UNIX for Advanced & Expert Users

ufsdump equivalent in linux and unix

Hi all, I am preparing for a worst case scenario. Say i have a production server A, should A fails ( for whatever reason), i want another server B to take over. How can i move everything from A to B? Assuming i have regular backup of A. I've searched in the forums, and briefly came across... (4 Replies)
Discussion started by: new2ss
4 Replies

10. Linux

Linux equivalent for daemon2

Hi all... In my Unix system a program exists called "daemon2" which is responsible to enqueue program executions. For example, if I want to make the system to enqueue lpr executions for certain users, I call daemon2 with lpr as the parameter. Is there an equivalent in Linux? Thanks Jaime (0 Replies)
Discussion started by: jstuardo
0 Replies

Featured Tech Videos