Sponsored Content
Full Discussion: Cut lines before keyword
Top Forums Shell Programming and Scripting Cut lines before keyword Post 302298940 by ghostdog74 on Wednesday 18th of March 2009 11:08:14 PM
Old 03-19-2009
Code:
# while read line;do echo ${line%%word*};done < file
1 2333214
2 234343 234234
3 234324 324 3234

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

display (ehco) 5 lines before and after find keyword

I like to display 5 lines before and after find some keywork (i.e. error). Thanks in advance (5 Replies)
Discussion started by: wangzosen
5 Replies

2. Shell Programming and Scripting

Delete the lines after the last instance of the keyword

I have my input sometyhing like this aaa bbbbbb cccccc ddddd eeeee 1234 ravi kumar aaaaaa vvvvvvv 5678 ravi kumar rrrrrrr mmmmmmm I want the output as follows. aaa bbbbbb cccccc ddddd eeeee 1234 ravi kumar aaaaaa vvvvvvv 5678 ravi kumar (2 Replies)
Discussion started by: rdhanek
2 Replies

3. Shell Programming and Scripting

Delete the lines before the first instance of the keyword

I have my data something like this. I want to delete all the lines before the frist instance of the key word 'ravi kumar' aaa bbbbbb cccccc ddddd eeeee 1234 ravi kumar aaaaaa vvvvvvv 5678 ravi kumar rrrrrrr mmmmmmm I want the output as follows. 1234 ravi kumar aaaaaa... (8 Replies)
Discussion started by: rdhanek
8 Replies

4. Shell Programming and Scripting

read the first 10 lines below a keyword found by grep

Hello Everyone, i need to read specific number of lines ( always serialized ; i.e from 10 to 20 or from 34 to 44 ) in a file , where the first line is found by grep 'ing a keyword. example file.txt ------------------------------------------------------------------ --header this is the... (7 Replies)
Discussion started by: alain.kazan
7 Replies

5. Shell Programming and Scripting

Removing Multiple lines below a keyword using SED?

I have 9,000 + html files. I am using the following to remove the content from a certain line up for i in `ls` do sed '1,569d' $i > $i.bak done This will remove the unwanted formatting keeping the content I need which changes in each HTML file. the problem I have now is that the... (2 Replies)
Discussion started by: deaconf19
2 Replies

6. Shell Programming and Scripting

Extract Lines Containg a Keyword

Hi , I have two files, say KEY_FILE and the MAIN_FILE. I am trying to read the KEY_FILE which has only one column and look for this column data in the MAIN_FILE to extract all the rows that have this key. I have written a script to do so, but somehow it is not returning all the rows ( It... (4 Replies)
Discussion started by: Sheel
4 Replies

7. Shell Programming and Scripting

Merge file lines based off of keyword

Hello Everyone, I have two files I created in a format similar to the ones found below (character position is important): File 1: 21 Cat Y N S Y Y N N FOUR LEGS TAIL WHISKERS 30 Dog N N 1 Y Y N N FOUR LEGS TAIL 33 Fish Y N 1 Y Y N N FINS 43 CAR Y N S Y Y N N WHEELS DOORS... (7 Replies)
Discussion started by: jl487
7 Replies

8. Shell Programming and Scripting

Displaying all the lines starting with some keyword

consider the contents of a file has many stuff including few stuff that i need.. so i perfromed the below function cat filename | grep "ALTER TABLE" its output is as shown below . . . . . SET @sql:=CONCAT('ALTER TABLE RecordMixProfile AUTO_INCREMENT=', @maxId) ; SET... (14 Replies)
Discussion started by: vivek d r
14 Replies

9. Shell Programming and Scripting

extract lines from text after keyword

I have a text and I want to extract the 4 lines following a keyword! For example if I have this text and the keyword is AAA hello helloo AAA one two three four helloooo hellooo I want the output to be one two three four (7 Replies)
Discussion started by: stekanius
7 Replies

10. Shell Programming and Scripting

awk join lines based on keyword

Hello , I will need your help once again. I have the following file: cat file02.txt PATTERN XXX.YYY.ZZZ. 500 ROW01 aaa. 300 XS 14 ROW 45 29 AS XD.FD. PATTERN 500 ZZYN002 ROW gdf gsste ALT 267 fhhfe.ddgdg. PATTERN ERE.MAY. 280 PATTERRNTH 5000 rt.rt. ROW SO a 678 PATTERN... (2 Replies)
Discussion started by: alex2005
2 Replies
PS_HYPHENATE(3) 							 1							   PS_HYPHENATE(3)

ps_hyphenate - Hyphenates a word

SYNOPSIS
array ps_hyphenate (resource $psdoc, string $text) DESCRIPTION
Hyphenates the passed word. ps_hyphenate(3) evaluates the value hyphenminchars (set by ps_set_value(3)) and the parameter hyphendict (set by ps_set_parameter(3)). hyphendict must be set before calling this function. This function requires the locale category LC_CTYPE to be set properly. This is done when the extension is initialized by using the envi- ronment variables. On Unix systems read the man page of locale for more information. PARAMETERS
o $psdoc - Resource identifier of the postscript file as returned by ps_new(3). o $text -$text should not contain any non alpha characters. Possible positions for breaks are returned in an array of interger numbers. Each number is the position of the char in $text after which a hyphenation can take place. RETURN VALUES
An array of integers indicating the position of possible breaks in the text or FALSE on failure. EXAMPLES
Example #1 Hyphennate a text <?php $word = "Koordinatensystem"; $psdoc = ps_new(); ps_set_parameter($psdoc, "hyphendict", "hyph_de.dic"); $hyphens = ps_hyphenate($psdoc, $word); for($i=0; $i<strlen($word); $i++) { echo $word[$i]; if(in_array($i, $hyphens)) echo "-"; } ps_delete($psdoc); ?> The above example will output: Ko-ordi-na-ten-sys-tem SEE ALSO
ps_show_boxed(3), locale(1). PHP Documentation Group PS_HYPHENATE(3)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy