Sponsored Content
Full Discussion: Documenting files with sed
Top Forums Shell Programming and Scripting Documenting files with sed Post 303000394 by f77hack on Tuesday 11th of July 2017 12:49:29 PM
Old 07-11-2017
Documenting files with sed

All,
I am looking for a way to improve this small one liner.

one of the files has this kind of format
Code:
public func <<<T>(array: [T], offset: Int) -> [T] { return array.shiftedLeft(by: offset)  }

Code:
gsed -i '/public func/i /\/\/\public func \n/\/\==mark==public func' t

results in
Code:
///public func 
//==mark==public func
public func <<<T>(array: [T], offset: Int) -> [T] { return array.shiftedLeft(by: offset)  }

i'd like the code to quickly parse to grab all of the string until it the first left parenthesis.

Code:
///public func <<<T>(array: [T], offset: Int) 
//==mark==public func <<<T>(array: [T], offset: Int) 
public func <<<T>(array: [T], offset: Int) -> [T] { return array.shiftedLeft(by: offset)  }

Thanks!
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Documenting a Shell Script

I've been working on a very long shell script that's becoming a mini-application. It is my first script, and continues to grow each week, becoming more and more complex. I've been asked to document my script, beginning with basic information and then detailing any information about its... (1 Reply)
Discussion started by: yongho
1 Replies

2. UNIX for Dummies Questions & Answers

Any easy way of documenting cron entries?

I've been asked to do a high level summary of the cron jobs which run against a number of systems (to understand the potential scope for rewriting some of our core systems)...and was wondering how people have done this in the past. I've got approx 400 cron entries to go through. I will have... (2 Replies)
Discussion started by: GavP
2 Replies

3. Programming

Documenting code

I am programming using C++ and am wondering how to comment my project. For example, when I declare a class I created a header with some description, then have the declaration stage, which I don't comment. Then when I define the actual functions I will put details about it, what it does,... (2 Replies)
Discussion started by: kristinu
2 Replies

4. Shell Programming and Scripting

Script Help -- documenting specific users that log into server

Hello All, I am trying trying to write a shell script that will do a couple things: 1.) Identify any username that logs into the server. 2.) When the user logs out, send them an email detailing their log in/out times, duration logged in, and what processes they ran. Basically,... (3 Replies)
Discussion started by: SecureScript
3 Replies

5. Web Development

Documenting Installation Problem with vue-beautiful-chat

REF: https://github.com/mattmezza/vue-beautiful-chat $ git clone https://github.com/mattmezza/vue-beautiful-chat.git Cloning into 'vue-beautiful-chat'... remote: Enumerating objects: 534, done. remote: Total 534 (delta 0), reused 0 (delta 0), pack-reused 534 Receiving objects: 100%... (2 Replies)
Discussion started by: Neo
2 Replies
SPHINXCLIENT(3) 							 1							   SPHINXCLIENT(3)

The SphinxClient class

INTRODUCTION
The SphinxClient class provides object-oriented interface to Sphinx. CLASS SYNOPSIS
SphinxClient SphinxClient Methods o public int SphinxClient::addQuery (string $query, [string $index = "*"], [string $comment = ""]) o public array SphinxClient::buildExcerpts (array $docs, string $index, string $words, [array $opts]) o public array SphinxClient::buildKeywords (string $query, string $index, bool $hits) o public bool SphinxClient::close (void ) o public SphinxClient::__construct (void ) o public string SphinxClient::escapeString (string $string) o public string SphinxClient::getLastError (void ) o public string SphinxClient::getLastWarning (void ) o public bool SphinxClient::open (void ) o public array SphinxClient::query (string $query, [string $index = "*"], [string $comment = ""]) o public void SphinxClient::resetFilters (void ) o public void SphinxClient::resetGroupBy (void ) o public array SphinxClient::runQueries (void ) o public bool SphinxClient::setArrayResult (bool $array_result = false) o public bool SphinxClient::setConnectTimeout (float $timeout) o public bool SphinxClient::setFieldWeights (array $weights) o public bool SphinxClient::setFilter (string $attribute, array $values, [bool $exclude = false]) o public bool SphinxClient::setFilterFloatRange (string $attribute, float $min, float $max, [bool $exclude = false]) o public bool SphinxClient::setFilterRange (string $attribute, int $min, int $max, [bool $exclude = false]) o public bool SphinxClient::setGeoAnchor (string $attrlat, string $attrlong, float $latitude, float $longitude) o public bool SphinxClient::setGroupBy (string $attribute, int $func, [string $groupsort = "@group desc"]) o public bool SphinxClient::setGroupDistinct (string $attribute) o public bool SphinxClient::setIDRange (int $min, int $max) o public bool SphinxClient::setIndexWeights (array $weights) o public bool SphinxClient::setLimits (int $offset, int $limit, [int $max_matches], [int $cutoff]) o public bool SphinxClient::setMatchMode (int $mode) o public bool SphinxClient::setMaxQueryTime (int $qtime) o public bool SphinxClient::setOverride (string $attribute, int $type, array $values) o public bool SphinxClient::setRankingMode (int $ranker) o public bool SphinxClient::setRetries (int $count, [int $delay]) o public bool SphinxClient::setSelect (string $clause) o public bool SphinxClient::setServer (string $server, int $port) o public bool SphinxClient::setSortMode (int $mode, [string $sortby]) o public array SphinxClient::status (void ) o public int SphinxClient::updateAttributes (string $index, array $attributes, array $values, [bool $mva = false]) PHP Documentation Group SPHINXCLIENT(3)
All times are GMT -4. The time now is 12:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy