Sponsored Content
Top Forums UNIX for Dummies Questions & Answers anchoring regex using case and ksh Post 302220367 by popeye on Thursday 31st of July 2008 01:07:17 PM
Old 07-31-2008
Instead of doing all the greps, Id rather read through the file. I dont want to use ifs, I want to use case. Ifs are shown for a psuedo code explaination.

while read ip model ios hostname
do
case $ios in

if $ios is 11.0 print I have 11.0
if $ios is 12.0 mainline print I have 12.0
if $ios is 12.0 not mainline print I have 12.0 T or above
if $ios is single digit followed by a single digit it must be an os print I have an os

esac
done < seedfile
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Case (ksh)

Isn't any "NOT" operator that can be used in the case construction like : case $VAR (NOT) in option1 | option2 | option 3...) COMMAND ;; esac Or something similiar to the "default" from switch, so I could at least do something like this: case $VAR in ... (2 Replies)
Discussion started by: 435 Gavea
2 Replies

2. Shell Programming and Scripting

ksh case problem

I'm trying to run a ksh script with a case condition to handle parameters. #!/bin/ksh db_start(){ *code } db_shut(){ *code } case "$1" in up) db_start TRNG ;; down) db_shut TRNG ;; *) echo "Usage: $0 { up | down }" (3 Replies)
Discussion started by: digiteck
3 Replies

3. Shell Programming and Scripting

How to specify 'not case sensitive' in regex (nawk, sed, patern expencions)?

Is it possible to make the search in regular exprecion or in matching parts of sed, nawk and others to IGNORE the case of the search string? I mean, like if used 'grep' with -i option: > grep -i "abc" file I would like to be able to do the same, say, by nawk: > nawk '/abc/ {print $0}'... (4 Replies)
Discussion started by: alex_5161
4 Replies

4. Shell Programming and Scripting

ksh case statement

I am trying to write a ksh script using the case statement to select certain directories to remove. The directories that I am looking for are in the following format 2008-10-10. I want to exclude all other files/directories that contain anything other the 4 digit year,a dash, 2 digit month, a... (2 Replies)
Discussion started by: dgilc
2 Replies

5. UNIX for Dummies Questions & Answers

ksh case structure

Hello Experts, I ve been trying to build another shell where I am using the following code. transact="tv5cpc1" case "$transact" in "...cp..") xActType="" ;; "...de..") xActType="sp_dep" ;; "...ep..") xActType="sp_epa" ;; "....v.") ... (4 Replies)
Discussion started by: hkansal
4 Replies

6. Shell Programming and Scripting

bash regex =~ case insensetive, possible?

It can get very annoying that bash regex =~ is case-sensetive, is there a way to set it to be case-insensetive? if ]; then echo match else echo no match fi (8 Replies)
Discussion started by: TehOne
8 Replies

7. Shell Programming and Scripting

[BASH] recognise new line regex in case statement

Hi, I'm trying to write a routine to parse a file that contains data that will be read into arrays. The file is composed of labels to identify data types and arbitrary lines of data with the usual remarks and empty new lines as is common with config files. The initial pass is built as so:... (3 Replies)
Discussion started by: ASGR
3 Replies

8. Shell Programming and Scripting

lower to upper case in ksh

What is the command to change the contents of a file to UPPER case. Here in this file below you see some characters are Sp, Ch 1200812270046581 22885072800000652 B86860003OLFXXX592123320081227 22885029800000652 B86860003ODL-Sp592123420081227 22885093700000652-B94030001ODL-Ch592123520081227... (4 Replies)
Discussion started by: kshuser
4 Replies

9. Shell Programming and Scripting

Using an array with a case statement in KSH

Hi, I'm really new ro shell scripting (actually any kind of programming) and am pretty sure I'm making a pretty basic error here but I can't for the life of me figure it out. What I'm trying to do is get an array working with a case statement in a KSH script. The code is as follows: ... (3 Replies)
Discussion started by: SReilly
3 Replies

10. Shell Programming and Scripting

Question about REGEX Patterns and Case Sensitivity?

Hello All, I'm in the middle of a script and I'm doing some checks with REGEX (i.e. using the '"shopt -s nocasematch" that at least the first one should print "FALSE" but it prints "TRUE"..? For Example: #!/bin/bash MY_VAR="HELLO" ### This prints "TRUE" PATTERN_1="^*" if ] then... (5 Replies)
Discussion started by: mrm5102
5 Replies
FBB::IOStreambuf(3bobcat)					   Error handler					 FBB::IOStreambuf(3bobcat)

NAME
FBB::IOStreambuf - streambuf allowing input and output operations SYNOPSIS
#include <bobcat/iostreambuf> Linking option: -lbobcat DESCRIPTION
This class implements a specialization of the std::streambuf class, allowing input operations from and output operations to different files. It is intended to be used in combination with FBB::IOStream, thus allowing all stream-based input and output operations using the same object without the need to use seek-operations. Using an FBB::IOStream object it is, e.g., possible to construct two-way communica- tions using pipes, much like the facilities offered by sockets. If the streams that will be associated with the IOStreambuf object support seeking, then the IOStreambuf will do so to. Seeking might also be availble for a single stream (either the std::istream or the std::ostream). When the IOStreambuf object goes out of scope, its associated std::ostream object is flushed. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
std::streambuf CONSTRUCTORS
o IOStreambuf(): The default constructor results in a IOStreambuf object that cannot be immediately used. Its member open() must be called first. o IOStreambuf(std::istream &in, std::ostream &out): This constructor associates the IOStreambuf object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStreambuf() should outlive the IOStreambuf object. De copy constructor is available as well. MEMBER FUNCTIONS
All members of std::streambuf are available, as FBB::IOStreambuf inherits from these classes. o void open(std::istream &in, std::ostream &out): This member (re)associates the IOStreambuf object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStreambuf() should outlive the IOStreambuf object. If this member is called for an IOStreambuf object already associated with an std::ostream object, the already associated std::ostream object is flushed before setting up the new association. VIRTUAL PROTECTED MEMBER FUNCTIONS
The following std::streambuf member functions should only be called when the FBB::Streambuf object is associated with std::istream and std::ostream objects (i.e., they should not be called between the construction of a default FBB:IOStreambuf object and a subsequent call of IOStreambuf::open()): The members listed in this section implement the tasks of comparably named virtual function in the class's private interface. This sepa- rates the redefinable interface from the user-interface. The class IOStreamBuf can, in accordance with Liskov's Substitution Principle, be used as a std:streambuf; but it also offers facilities for classes deriving from IOStreamBuf. These facilities are listed here. o pos_type pSeekoff(off_type offset, std::ios::seekdir way, std::ios::openmode mode = std::ios::in | std::ios::out): With seekable streams, repositions the associated std::istream or std::ostream is repositioned to offset offset, relative to way. o pos_type pSeekpos(off_type offset, std::ios::openmode mode = std::ios::in | std::ios::out): With seekable streams, repositions the associated std::istream or std::ostream is repositioned to offset offset, relative to the beginning of the stream. o int pSync(): This member flushes the associated std::ostream object. o std::streamsize pXsputn(char const *buffer, std::streamsize n): This member inserts n characters from buffer into the associated std::ostream stream. EXAMPLE
See the example provided with process(3bobcat). FILES
bobcat/iostreambuf - defines the class interface SEE ALSO
bobcat(7), iostream(3bobcat), process(3bobcat) BUGS
None reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::IOStreambuf(3bobcat)
All times are GMT -4. The time now is 03:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy