Sponsored Content
Top Forums Shell Programming and Scripting can I remove the first char using AWK? Post 302484936 by Abdulelah on Monday 3rd of January 2011 05:18:11 PM
Old 01-03-2011
that was awsome and quick

Many thanks citaylor
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove new line char from a string

Hi Can anyone tell me how can i remove new line character from a string. My requirement is to read a line from a file and store it to a string. read line string1=$line read line string2=$line echo $string1$string2 The result i am getting in different line. i want the output in the same... (1 Reply)
Discussion started by: sreedivia
1 Replies

2. Shell Programming and Scripting

Help needed to remove a char from a specified sub-string

Hi! I'm having trouble usind sed to remove the char ' from within a database's varchar register's sql. For example, on the following sql: INSERT INTO patrimonio_municipal.patrimonio_municipal_airc_tmp Values('|Estação Elevatória|',|16723|,'|Grandes Reparações|', '|2010-03-26... (3 Replies)
Discussion started by: cremat0rio
3 Replies

3. Shell Programming and Scripting

Remove char after Colon

Hi guys, This is my input 2735:<7001> 34 789 701 2 2774:<7001> 34 789 701 2 How to delete characters after colon : Including colon : too ? My output should... (3 Replies)
Discussion started by: gowrishankar05
3 Replies

4. UNIX Desktop Questions & Answers

Help me to remove junk char

I wanted to remove junk char in my csv. :mad: Input file format: "17","9986782190","0","D","2" "17","9900918331","0","D","2" "13","9986782194","0","A","2" Output file format 9986782190 9900918331 9986782194 And one more thing all the time "13"," this will be different Ex: . (2 Replies)
Discussion started by: Siddartha
2 Replies

5. Red Hat

How to remove a special char using sed

consider this is my sample file format. in this i want to remove ^@ with space . please help me in this problm 7305,1310184890,0,0,12,201370,FCASTBHBR0 ,XX ,2,1,2,0,^@,1,1,0,3,1303862400,0,1577923199,1,10,FCASTOR SEED EX-BHABHAR ... (2 Replies)
Discussion started by: ponmuthu-lnx
2 Replies

6. Shell Programming and Scripting

How to remove the # char form a line?

Hi, my file has below details and I want remove the # char from only specific line. #TEST:00:START #TEST1:01:INPROCESS #TEST2:02:ABOUTTO #TEST3:03:COMP i.e if want remove the # from 2nd line then file to be updated as #TEST:00:START TEST1:01:INPROCESS #TEST2:02:ABOUTTO... (6 Replies)
Discussion started by: sandyrajh
6 Replies

7. UNIX for Dummies Questions & Answers

Remove newline char from variable

I have a file ABC.DAT with 2 columns avaialble Data format : XYZ!$#$!120 XXZ!$#$!1000 YYZ!$#$!104 While running the following code : FILE_COUNTER=1; RECORD_CN_FILE_COUNT=$((`wc -l ABC.DAT| cut -f1 -d' '`)); while do FILE_NAME=`cat ABC.DAT.DAT| head -$FILE_COUNTER |tail -1 | awk -F... (1 Reply)
Discussion started by: Nikhil Gautam
1 Replies

8. UNIX for Dummies Questions & Answers

Remove char if not a number

I need to write a BASH script that takes a 2 character string and removes the second character if it is not a digit e.g. If the string is numberical value >9 e.g. string1 = '34' then leave string1 = '34'. However if the string is <10 e.g. string1 = '3X' then remove the second char (which... (7 Replies)
Discussion started by: millsy5
7 Replies

9. Shell Programming and Scripting

Remove double char occurences

I have a file with random characters where every time a char occurs twice, one occurrence must be removed. Eg. asjkdhaSSd Must become: asjkdhaSd Anybody has a SED script in mind to do it? (1 Reply)
Discussion started by: rlopes
1 Replies

10. UNIX for Advanced & Expert Users

How to remove a char before a pattern?

Hi I have a file where i want to remove a char before a specific pattern. exp: CREATE TABLE ( A, B, C, ----comma needs to be removed )AS SELECT A, B, C, ----comma needs to be removed FROM TABLE. So i want to delete the comma(,) after the C both ways.Pattern can be... (11 Replies)
Discussion started by: raju2016
11 Replies
Text::Context::EitherSide(3pm)				User Contributed Perl Documentation			    Text::Context::EitherSide(3pm)

NAME
Text::Context::EitherSide - Get n words either side of search keywords SYNOPSIS
use Text::Context::EitherSide; my $text = "The quick brown fox jumped over the lazy dog"; my $context = Text::Context::EitherSide->new($text); $context->as_string("fox") # "... quick brown fox jumped over ..." $context->as_string("fox", "jumped") # "... quick brown fox jumped over the ..." my $context = Text::Context::EitherSide->new($text, context => 1); # 1 word on either side $context->as_string("fox", "jumped", "dog"); # "... brown fox jumped over ... lazy dog", Or, if you don't believe in all this OO rubbish: use Text::Context::EitherSide qw(get_context); get_context(1, $text, "fox", "jumped", "dog") # "... brown fox jumped over ... lazy dog" DESCRIPTION
Suppose you have a large piece of text - typically, say, a web page or a mail message. And now suppose you've done some kind of full-text search on that text for a bunch of keywords, and you want to display the context in which you found the keywords inside the body of the text. A simple-minded way to do that would be just to get the two words either side of each keyword. But hey, don't be too simple minded, because you've got to make sure that the list doesn't overlap. If you have the quick brown fox jumped over the lazy dog and you extract two words either side of "fox", "jumped" and "dog", you really don't want to end up with quick brown fox jumped over brown fox jumped over the the lazy dog so you need a small amount of smarts. This module has a small amount of smarts. EXPORTABLE
get_context This is primarily an object-oriented module. If you don't care about that, just import the "get_context" subroutine, and call it like so: get_context($num_of_words, $text, @words_to_find) and you'll get back a string with ellipses as in the synopsis. That's all that most people need to know. But if you want to do clever stuff... METHODS
new my $c = Text::Context::EitherSite->new($text [, context=> $n]); Create a new object storing some text to be searched, plus optionally some information about how many words on either side you want. (If you don't like the default of 2.) context $c->context(5); Allows you to get and set the number of the words on either side. as_sparse_list $c->as_sparse_list(@keywords) Returns the keywords, plus n words on either side, as a sparse list; the original text is split into an array of words, and non-contextual elements are replaced with "undef"s. (That's not actually how it works, but conceptually, it's the same.) as_list $c->as_list(@keywords) The same as "as_sparse_list", but single or multiple "undef"s are collapsed into a single ellipsis: (undef, "foo", undef, undef, undef, "bar") becomes ("...", "foo", "...", "bar") as_string $c->as_string(@keywords) Takes the "as_list" output above and joins them all together into a string. This is what most people want from "Text::Context::EitherSide". EXPORT "get_context" is available as a shortcut for Text::Context::EitherSide->new($text, context => $n)->as_string(@words); but needs to be explicitly imported. Nothing is exported by default. SEE ALSO
Text::Context is an even smarter way of extracting a contextual string. AUTHOR
Current maintainer: Tony Bowden Original author: Simon Cozens BUGS and QUERIES Please direct all correspondence regarding this module to: bug-Text-Context-EitherSide@rt.cpan.org COPYRIGHT AND LICENSE
Copyright 2002-2005 by Kasei Limited, http://www.kasei.com/ You may use and redistribute this module under the terms of the Artistic License 2.0. http://www.perlfoundation.org/artistic_license_2_0 perl v5.10.0 2009-05-04 Text::Context::EitherSide(3pm)
All times are GMT -4. The time now is 01:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy