Sponsored Content
Full Discussion: between command?
Top Forums UNIX for Dummies Questions & Answers between command? Post 302697187 by pamu on Thursday 6th of September 2012 08:26:55 AM
Old 09-06-2012
So whats the problem...????

Use awk...

You know the column number. Just compare it with ..< and > signs.Smilie
 

10 More Discussions You Might Find Interesting

1. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

2. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

3. AIX

AIX:Command to get netaddress/subnet address command in IPv4/IP6

AIX:Command to get netaddress/subnet address command in IPv4/IP6 Can anybody help us with a command to retrieve netaddress/subnet address command in IPv4/IP6 on aix machine. net/subnet address is in the format 172.16.212.0(signifies all 255 machines in an IPv4 network) (2 Replies)
Discussion started by: rookie8278
2 Replies

4. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

5. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

6. UNIX for Dummies Questions & Answers

passing command output from one command to the next command in cshell

HI Guys, I hope you are well. I am trying to write a script that gets executed every time i open a shell (cshell). I have two questions about that 1) I need to enter these commands $ echo $DISPLAY $ setenv $DISPLAY output_of_echo_$display_command How can i write a... (2 Replies)
Discussion started by: kaaliakahn
2 Replies

7. Shell Programming and Scripting

SH script, variable built command fails, but works at command line

I am working with a sh script on a solaris 9 zone (sol 10 host) that grabs information to build the configuration command line. the variables Build64, SSLopt, CONFIGopt, and CC are populated in the script. the script includes CC=`which gcc` CONFIGopt=' --prefix=/ --exec-prefix=/usr... (8 Replies)
Discussion started by: oly_r
8 Replies

8. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

9. AIX

I'm facing problem with rpm command, when running the command and appears this error:

exec(): 0509-036 Cannot load program /usr/opt/freeware/bin/rpm because of the following errors: 0509-022 Cannot load module /opt/freeware/lib/libintl.a(libintl.so.1). 0509-150 Dependent module /opt/freeware/lib/libiconv.a(shr4.o) could not be loaded. 0509-152 Member... (4 Replies)
Discussion started by: Ohmkar
4 Replies

10. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies
QMap(3qt)																 QMap(3qt)

NAME
QMap - Value-based template class that provides a dictionary SYNOPSIS
#include <qmap.h> Public Members typedef Key key_type typedef T mapped_type typedef QPair<const key_type, mapped_type> value_type typedef value_type * pointer typedef const value_type * const_pointer typedef value_type & reference typedef const value_type & const_reference typedef size_t size_type typedef QMapIterator<Key, T> iterator typedef QMapConstIterator<Key, T> const_iterator typedef QPair<iterator, bool> insert_pair typedef QMapIterator<Key, T> Iterator typedef QMapConstIterator<Key, T> ConstIterator typedef T ValueType QMap () QMap ( const QMap<Key, T> & m ) QMap ( const std::map<Key, T> & m ) ~QMap () QMap<Key, T> & operator= ( const QMap<Key, T> & m ) QMap<Key, T> & operator= ( const std::map<Key, T> & m ) iterator begin () iterator end () const_iterator begin () const const_iterator end () const iterator replace ( const Key & k, const T & v ) size_type size () const bool empty () const QPair<iterator, bool> insert ( const value_type & x ) void erase ( iterator it ) void erase ( const key_type & k ) size_type count ( const key_type & k ) const T & operator[] ( const Key & k ) void clear () iterator find ( const Key & k ) const_iterator find ( const Key & k ) const const T & operator[] ( const Key & k ) const bool contains ( const Key & k ) const size_type count () const QValueList<Key> keys () const QValueList<T> values () const bool isEmpty () const iterator insert ( const Key & key, const T & value, bool overwrite = TRUE ) void remove ( iterator it ) void remove ( const Key & k ) Protected Members void detach () RELATED FUNCTION DOCUMENTATION
QDataStream & operator>> ( QDataStream & s, QMap<Key, T> & m ) QDataStream & operator<< ( QDataStream & s, const QMap<Key, T> & m ) DESCRIPTION
The QMap class is a value-based template class that provides a dictionary. QMap is a Qt implementation of an STL-like map container. It can be used in your application if the standard map is not available on all your target platforms. QMap is part of the Qt Template Library. QMap<Key, Data> defines a template instance to create a dictionary with keys of type Key and values of type Data. QMap does not store pointers to the members of the map; instead, it holds a copy of every member. For this reason, QMap is value-based, whereas QPtrList and QDict are pointer-based. QMap contains and manages a collection of objects of type Data with associated key values of type Key and provides iterators that allow the contained objects to be addressed. QMap owns the contained items. Some classes cannot be used within a QMap. For example everything derived from QObject and thus all classes that implement widgets. Only values can be used in a QMap. To qualify as a value, the class must provide A copy constructor An assignment operator A default constructor, i.e. a constructor that does not take any arguments. Note that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases, this is sufficient. The class used for the key requires that the operator< is implemented to define ordering of the keys. QMap's function naming is consistent with the other Qt classes (e.g., count(), isEmpty()). QMap also provides extra functions for compatibility with STL algorithms, such as size() and empty(). Programmers already familiar with the STL map can use these the STL-like functions if preferred. Example: #include <qstring.h> #include <qmap.h> #include <qstring.h> class Employee { public: Employee(): sn(0) {} Employee( const QString& forename, const QString& surname, int salary ) : fn(forename), sn(surname), sal(salary) { } QString forename() const { return fn; } QString surname() const { return sn; } int salary() const { return sal; } void setSalary( int salary ) { sal = salary; } private: QString fn; QString sn; int sal; }; int main(int argc, char **argv) { QApplication app( argc, argv ); typedef QMap<QString, Employee> EmployeeMap; EmployeeMap map; map["JD001"] = Employee("John", "Doe", 50000); map["JW002"] = Employee("Jane", "Williams", 80000); map["TJ001"] = Employee("Tom", "Jones", 60000); Employee sasha( "Sasha", "Hind", 50000 ); map["SH001"] = sasha; sasha.setSalary( 40000 ); EmployeeMap::Iterator it; for ( it = map.begin(); it != map.end(); ++it ) { printf( "%s: %s, %s earns %d ", it.key().latin1(), it.data().surname().latin1(), it.data().forename().latin1(), it.data().salary() ); } return 0; } Program output: JD001: Doe, John earns 50000 JW002: Williams, Jane earns 80000 SH001: Hind, Sasha earns 50000 TJ001: Jones, Tom earns 60000 The latest changes to Sasha's salary did not affect the value in the list because the map created a copy of Sasha's entry. In addition, notice that the items are sorted alphabetically (by key) when iterating over the map. There are several ways to find items in a map. The begin() and end() functions return iterators to the beginning and end of the map. The advantage of using an iterator is that you can move forward or backward by incrementing/decrementing the iterator. The iterator returned by end() points to the element which is one past the last element in the container. The past-the-end iterator is still associated with the map it belongs to, however it is not dereferenceable; operator*() will not return a well-defined value. If the map is empty, the iterator returned by begin() will equal the iterator returned by end(). Another way to find an element in the map is by using the find() function. This returns an iterator pointing to the desired item or to the end() iterator if no such element exists. Another approach uses the operator[]. But be warned: if the map does not contain an entry for the element you are looking for, operator[] inserts a default value. If you do not know that the element you are searching for is really in the list, you should not use operator[]. The following example illustrates this: QMap<QString,QString> map; map["Clinton"] = "Bill"; str << map["Clinton"] << map["Bush"] << endl; The code fragment will print out "Clinton", "". Since the value associated with the "Bush" key did not exist, the map inserted a default value (in this case, an empty string). If you are not sure whether a certain element is in the map, you should use find() and iterators instead. If you just want to know whether a certain key is contained in the map, use the contains() function. In addition, count() tells you how many keys are in the map. It is safe to have multiple iterators at the same time. If some member of the map is removed, only iterators pointing to the removed member become invalid; inserting in the map does not invalidate any iterators. Since QMap is value-based, there is no need to be concerned about deleting items in the map. The map holds its own copies and will free them if the corresponding member or the map itself is deleted. QMap is implicitly shared. This means you can just make copies of the map in time O(1). If multiple QMap instances share the same data and one is modifying the map's data, this modifying instance makes a copy and modifies its private copy: so it does not affect other instances. If a QMap is being used in a multi-threaded program, you must protect all access to the map. See QMutex. There are a couple of ways of inserting new items into the map. One uses the insert() method; the other uses operator[]: QMap<QString, QString> map; map["Clinton"] = "Bill"; map.insert( qMakePair("Bush", "George") ); Items can also be removed from the map in several ways. One way is to pass an iterator to remove(). Another way is to pass a key value to remove(), which will delete the entry with the requested key. In addition you can clear the entire map using the clear() method. See also QMapIterator, Qt Template Library Classes, Implicitly and Explicitly Shared Classes, and Non-GUI Classes. Member Type Documentation QMap::ConstIterator The map's const iterator type, Qt style. QMap::Iterator The map's iterator type, Qt style. QMap::ValueType Corresponds to QPair<key_type, mapped_type>, Qt style. QMap::const_iterator The map's const iterator type. QMap::const_pointer Const pointer to value_type. QMap::const_reference Const reference to value_type. QMap::iterator The map's iterator type. QMap::key_type The map's key type. QMap::mapped_type The map's data type. QMap::pointer Pointer to value_type. QMap::reference Reference to value_type. QMap::size_type An unsigned integral type, used to represent various sizes. QMap::value_type Corresponds to QPair<key_type, mapped_type>. MEMBER FUNCTION DOCUMENTATION
QMap::QMap () Constructs an empty map. QMap::QMap ( const QMap<Key, T> & m ) Constructs a copy of m. This operation costs O(1) time because QMap is implicitly shared. This makes returning a QMap from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and this takes O(n) time. QMap::QMap ( const std::map<Key, T> & m ) Constructs a copy of m. QMap::~QMap () Destroys the map. References to the values in the map and all iterators of this map become invalidated. Since QMap is highly tuned for performance you won't see warnings if you use invalid iterators, because it is not possible for an iterator to check whether it is valid or not. iterator QMap::begin () Returns an iterator pointing to the first element in the map. This iterator equals end() if the map is empty. The items in the map are traversed in the order defined by operator<(Key, Key). See also end() and QMapIterator. const_iterator QMap::begin () const This is an overloaded member function, provided for convenience. It behaves essentially like the above function. See also end() and QMapConstIterator. void QMap::clear () Removes all items from the map. See also remove(). bool QMap::contains ( const Key & k ) const Returns TRUE if the map contains an item with key k; otherwise returns FALSE. size_type QMap::count ( const key_type & k ) const Returns the number of items whose key is k. Since QMap does not allow duplicate keys, the return value is always 0 or 1. This function is provided for STL compatibility. size_type QMap::count () const This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Returns the number of items in the map. See also isEmpty(). void QMap::detach () [protected] If the map does not share its data with another QMap instance, nothing happens; otherwise the function creates a new copy of this map and detaches from the shared one. This function is called whenever the map is modified. The implicit sharing mechanism is implemented this way. bool QMap::empty () const Returns TRUE if the map contains no items; otherwise returns FALSE. This function is provided for STL compatibility. It is equivalent to isEmpty(). See also size(). iterator QMap::end () The iterator returned by end() points to the element which is one past the last element in the container. The past-the-end iterator is still associated with the map it belongs to, but it is not dereferenceable; operator*() will not return a well-defined value. This iterator equals begin() if the map is empty. See also begin() and QMapIterator. const_iterator QMap::end () const This is an overloaded member function, provided for convenience. It behaves essentially like the above function. void QMap::erase ( iterator it ) Removes the item associated with the iterator it from the map. This function is provided for STL compatibility. It is equivalent to remove(). See also clear(). void QMap::erase ( const key_type & k ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Removes the item with the key k from the map. iterator QMap::find ( const Key & k ) Returns an iterator pointing to the element with key k in the map. Returns end() if no key matched. See also QMapIterator. const_iterator QMap::find ( const Key & k ) const This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Returns an iterator pointing to the element with key k in the map. Returns end() if no key matched. See also QMapConstIterator. iterator QMap::insert ( const Key & key, const T & value, bool overwrite = TRUE ) Inserts a new item with the key, key, and a value of value. If there is already an item whose key is key, that item's value is replaced with value, unless overwrite is FALSE (it is TRUE by default). QPair<;iterator, bool> QMap::insert ( const value_type & x ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Inserts the (key, value) pair x into the map. x is a QPair whose first element is a key to be inserted and whose second element is the associated value to be inserted. Returns a pair whose first element is an iterator pointing to the inserted item and whose second element is a bool indicating TRUE if x was inserted and FALSE if it was not inserted, e.g. because it was already present. See also replace(). bool QMap::isEmpty () const Returns TRUE if the map contains no items; otherwise returns FALSE. See also count(). QValueList<;Key> QMap::keys () const Returns a list of all the keys in the map. QMap<;Key, T> & QMap::operator= ( const QMap<Key, T> & m ) Assigns m to this map and returns a reference to this map. All iterators of the current map become invalidated by this operation. The cost of such an assignment is O(1), because QMap is implicitly shared. QMap<;Key, T> & QMap::operator= ( const std::map<Key, T> & m ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Assigns m to this map and returns a reference to this map. All iterators of the current map become invalidated by this operation. T &; QMap::operator[] ( const Key & k ) Returns the value associated with the key k. If no such key is present, an empty item is inserted with this key and a reference to the empty item is returned. You can use this operator both for reading and writing: QMap<QString, QString> map; map["Clinton"] = "Bill"; stream << map["Clinton"]; const T &; QMap::operator[] ( const Key & k ) const This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Warning: This function differs from the non-const version of the same function. It will not insert an empty value if the key k does not exist. This may lead to logic errors in your program. You should check if the element exists before calling this function. Returns the value associated with the key k. If no such key is present, a reference to an empty item is returned. void QMap::remove ( iterator it ) Removes the item associated with the iterator it from the map. See also clear(). void QMap::remove ( const Key & k ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Removes the item with the key k from the map. iterator QMap::replace ( const Key & k, const T & v ) Replaces the value of the element with key k, with the value v. See also insert() and remove(). size_type QMap::size () const Returns the number of items in the map. This function is provided for STL compatibility. It is equivalent to count(). See also empty(). QValueList<;T> QMap::values () const Returns a list of all the values in the map. RELATED FUNCTION DOCUMENTATION
QDataStream &; operator<< ( QDataStream & s, const QMap<Key, T> & m ) Writes the map m to the stream s. The types Key and T must implement the streaming operator as well. QDataStream &; operator>> ( QDataStream & s, QMap<Key, T> & m ) Reads the map m from the stream s. The types Key and T must implement the streaming operator as well. SEE ALSO
http://doc.trolltech.com/qmap.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qmap.3qt) and the Qt version (3.1.1). Trolltech AS 9 December 2002 QMap(3qt)
All times are GMT -4. The time now is 04:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy