Sponsored Content
Top Forums Shell Programming and Scripting Remove certain section from the line Post 302344490 by shantanuo on Monday 17th of August 2009 12:11:00 AM
Old 08-17-2009
Remove certain section from the line

A typical line looks like this...

Code:
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=129  COMMENT='Compiled E-Mails';

I want to remove DEFAULT CHARSET= and COLLATE= after resetting AUTO_INCREMENT=0
I do not want to change the engine and comment.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help find a section line of a file

hi, I have a 20 line file. I need a command which will brinf back a specific line based upon the line number I enter. e.g. the file looks like this and is called file1 jim is a man john is a woman james is a man wendy is a woman lesley is a woman i want a command that will... (4 Replies)
Discussion started by: sureshy
4 Replies

2. Shell Programming and Scripting

how to retreive certain section of the line

Hi I am using "grep" command to get certain pattern out of the file: PNUM=34 $ grep -w "#${PNUM}" myfile #34 * 2297 * 410 * 964 * * 4352 $ Is there a way to retrieve the section of the above output without #34 so the output would look like this:... (3 Replies)
Discussion started by: aoussenko
3 Replies

3. Shell Programming and Scripting

Duplicate Line Report per Section

I've been working on a script (/bin/sh) in which I have requested and received help here (in which I am very grateful for!). The client has modified their requirements (a tad), so without messing up the script to much, I come once again for assistance. Here are the file.dat contents: ABC1... (4 Replies)
Discussion started by: petersf
4 Replies

4. Shell Programming and Scripting

Search and Remove No data Section

Hello, I have written a script that removes duplicates within a file and places them in another report. File: ABC1 012345 header ABC2 7890-000 ABC3 012345 Content Header ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 ABC5 593.5000 587.6580 ABC1 67890 header ABC2 1234-0001 ABC3... (2 Replies)
Discussion started by: petersf
2 Replies

5. Shell Programming and Scripting

Extract section of file based on word in section

I have a list of Servers in no particular order as follows: virtualMachines="IIBSBS IIBVICDMS01 IIBVICMA01"And I am generating some output from a pre-existing script that gives me the following (this is a sample output selection). 9/17/2010 8:00:05 PM: Normal backup using VDRBACKUPS... (2 Replies)
Discussion started by: jelloir
2 Replies

6. Shell Programming and Scripting

remove <br> not in section

I need to remove the <BR> from all sections of a page, except what is between a section of text: #!/bin/sh sed ' /Testing Considerations/,/<B>PT# - Description:/ ! { s/<BR>// } ' But this isn't working. I'm not using the ! operator correctly, can someone... (2 Replies)
Discussion started by: dba_frog
2 Replies

7. Shell Programming and Scripting

Prepend first line of section to each line until the next section header

I have searched in a variety of ways in a variety of places but have come up empty. I would like to prepend a portion of a section header to each following line until the next section header. I have been using sed for most things up until now but I'd go for a solution in just about anything--... (7 Replies)
Discussion started by: pagrus
7 Replies

8. Shell Programming and Scripting

Print the first n line in each section

Hi, i have a file like this: ... 11111111 22222222 33333333 # 4444444 5555555 6666666 7777777 # ... i want just print the 2 first line between each section (each section is separated with "#"). so desired output would be like this: ... 11111111 22222222 (3 Replies)
Discussion started by: saeed.soltani
3 Replies

9. Shell Programming and Scripting

Grep or print each section of a file on one line with a separator

I can obtain information from itdt inventory command however it display as below, I'd like to print each entity on one line but seperated by : the file is something like and each section ends with Volume Tag Drive Address 256 Drive State ................... Normal ASC/ASCQ... (3 Replies)
Discussion started by: gefa
3 Replies

10. Shell Programming and Scripting

How to change file section into each line?

Hi Gurus, I have below file which has different sections, need to move the sections to beginning of the each record. original file aaa bbb ccc ddd eee fff output file. aaa bbb ccc ddd eee fff (6 Replies)
Discussion started by: green_k
6 Replies
GAMMU-SMSD-MYSQL(7)						       Gammu						       GAMMU-SMSD-MYSQL(7)

NAME
gammu-smsd-mysql - gammu-smsd(1) backend using MySQL database server as a message storage DESCRIPTION
MYSQL backend stores all data in a MySQL database server, which parameters are defined by configuration (see gammu-smsdrc for description of configuration options). For tables description see gammu-smsd-tables. This backend is based on gammu-smsd-sql. CONFIGURATION
Before running gammu-smsd you need to create necessary tables in the database, which is described bellow. The configuration file then can look like: [smsd] service = sql driver = native_mysql host = localhost See also gammu-smsdrc PRIVILEGES
The user accessing the database does not need much privileges, the following privleges should be enough: GRANT USAGE ON *.* TO 'smsd'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT, INSERT, UPDATE, DELETE ON `smsd`.* TO 'smsd'@'localhost'; Note For creating the SQL tables you need more privileges, especially for creating triggers, which are used for some functionality. CREATING TABLES
SQL script for creating tables in MySQL database: -- phpMyAdmin SQL Dump -- version 2.8.0.3 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 10, 2006 at 11:08 PM -- Server version: 5.0.18 -- PHP Version: 5.1.3 -- -- Database: `smsd` -- -- -------------------------------------------------------- -- -- Table structure for table `daemons` -- CREATE TABLE `daemons` ( `Start` text NOT NULL, `Info` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `daemons` -- -- -------------------------------------------------------- -- -- Table structure for table `gammu` -- CREATE TABLE `gammu` ( `Version` integer NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `gammu` -- INSERT INTO `gammu` (`Version`) VALUES(13); -- -------------------------------------------------------- -- -- Table structure for table `inbox` -- CREATE TABLE `inbox` ( `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `ReceivingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00', `Text` text NOT NULL, `SenderNumber` varchar(20) NOT NULL default '', `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression', `UDH` text NOT NULL, `SMSCNumber` varchar(20) NOT NULL default '', `Class` integer NOT NULL default '-1', `TextDecoded` text NOT NULL default '', `ID` integer unsigned NOT NULL auto_increment, `RecipientID` text NOT NULL, `Processed` enum('false','true') NOT NULL default 'false', PRIMARY KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `inbox` -- -- -------------------------------------------------------- -- -- Table structure for table `outbox` -- CREATE TABLE `outbox` ( `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00', `SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00', `SendBefore` time NOT NULL DEFAULT '23:59:59', `SendAfter` time NOT NULL DEFAULT '00:00:00', `Text` text, `DestinationNumber` varchar(20) NOT NULL default '', `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression', `UDH` text, `Class` integer default '-1', `TextDecoded` text NOT NULL default '', `ID` integer unsigned NOT NULL auto_increment, `MultiPart` enum('false','true') default 'false', `RelativeValidity` integer default '-1', `SenderID` varchar(255), `SendingTimeOut` timestamp NULL default '0000-00-00 00:00:00', `DeliveryReport` enum('default','yes','no') default 'default', `CreatorID` text NOT NULL, PRIMARY KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut); CREATE INDEX outbox_sender ON outbox(SenderID); -- -- Dumping data for table `outbox` -- -- -------------------------------------------------------- -- -- Table structure for table `outbox_multipart` -- CREATE TABLE `outbox_multipart` ( `Text` text, `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression', `UDH` text, `Class` integer default '-1', `TextDecoded` text default NULL, `ID` integer unsigned NOT NULL default '0', `SequencePosition` integer NOT NULL default '1', PRIMARY KEY (`ID`, `SequencePosition`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `outbox_multipart` -- -- -------------------------------------------------------- -- -- Table structure for table `pbk` -- CREATE TABLE `pbk` ( `ID` integer NOT NULL auto_increment, `GroupID` integer NOT NULL default '-1', `Name` text NOT NULL, `Number` text NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `pbk` -- -- -------------------------------------------------------- -- -- Table structure for table `pbk_groups` -- CREATE TABLE `pbk_groups` ( `Name` text NOT NULL, `ID` integer NOT NULL auto_increment, PRIMARY KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `pbk_groups` -- -- -------------------------------------------------------- -- -- Table structure for table `phones` -- CREATE TABLE `phones` ( `ID` text NOT NULL, `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00', `TimeOut` timestamp NOT NULL default '0000-00-00 00:00:00', `Send` enum('yes','no') NOT NULL default 'no', `Receive` enum('yes','no') NOT NULL default 'no', `IMEI` varchar(35) NOT NULL, `Client` text NOT NULL, `Battery` integer NOT NULL DEFAULT -1, `Signal` integer NOT NULL DEFAULT -1, `Sent` int NOT NULL DEFAULT 0, `Received` int NOT NULL DEFAULT 0, PRIMARY KEY (`IMEI`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `phones` -- -- -------------------------------------------------------- -- -- Table structure for table `sentitems` -- CREATE TABLE `sentitems` ( `UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00', `SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00', `DeliveryDateTime` timestamp NULL, `Text` text NOT NULL, `DestinationNumber` varchar(20) NOT NULL default '', `Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression', `UDH` text NOT NULL, `SMSCNumber` varchar(20) NOT NULL default '', `Class` integer NOT NULL default '-1', `TextDecoded` text NOT NULL default '', `ID` integer unsigned NOT NULL default '0', `SenderID` varchar(255) NOT NULL, `SequencePosition` integer NOT NULL default '1', `Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK', `StatusError` integer NOT NULL default '-1', `TPMR` integer NOT NULL default '-1', `RelativeValidity` integer NOT NULL default '-1', `CreatorID` text NOT NULL, PRIMARY KEY (`ID`, `SequencePosition`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime); CREATE INDEX sentitems_tpmr ON sentitems(TPMR); CREATE INDEX sentitems_dest ON sentitems(DestinationNumber); CREATE INDEX sentitems_sender ON sentitems(SenderID); -- -- Dumping data for table `sentitems` -- -- -- Triggers for setting default timestamps -- DELIMITER // CREATE TRIGGER inbox_timestamp BEFORE INSERT ON inbox FOR EACH ROW BEGIN IF NEW.ReceivingDateTime = '0000-00-00 00:00:00' THEN SET NEW.ReceivingDateTime = CURRENT_TIMESTAMP(); END IF; END;// CREATE TRIGGER outbox_timestamp BEFORE INSERT ON outbox FOR EACH ROW BEGIN IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN SET NEW.InsertIntoDB = CURRENT_TIMESTAMP(); END IF; IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN SET NEW.SendingDateTime = CURRENT_TIMESTAMP(); END IF; IF NEW.SendingTimeOut = '0000-00-00 00:00:00' THEN SET NEW.SendingTimeOut = CURRENT_TIMESTAMP(); END IF; END;// CREATE TRIGGER phones_timestamp BEFORE INSERT ON phones FOR EACH ROW BEGIN IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN SET NEW.InsertIntoDB = CURRENT_TIMESTAMP(); END IF; IF NEW.TimeOut = '0000-00-00 00:00:00' THEN SET NEW.TimeOut = CURRENT_TIMESTAMP(); END IF; END;// CREATE TRIGGER sentitems_timestamp BEFORE INSERT ON sentitems FOR EACH ROW BEGIN IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN SET NEW.InsertIntoDB = CURRENT_TIMESTAMP(); END IF; IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN SET NEW.SendingDateTime = CURRENT_TIMESTAMP(); END IF; END;// DELIMITER ; Note You can find the script in docs/sql/mysql.sql as well. UPGRADING TABLES
The easiest way to upgrade database structure is to backup old one and start with creating new one based on example above. For upgrading existing database, you can use changes described in smsd-tables-history and then manually update Version field in gammu ta- ble. AUTHOR
Michal iha <michal@cihar.com> COPYRIGHT
2009-2012, Michal iha <michal@cihar.com> 1.31.90 February 24, 2012 GAMMU-SMSD-MYSQL(7)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy