Sponsored Content
Top Forums Shell Programming and Scripting Discard part of a file based on a pattern --- Post 302902184 by eagle_fly on Monday 19th of May 2014 07:59:31 AM
Old 05-19-2014
Discard part of a file based on a pattern ---

I have the file:

Code:
s3_T0(2) Pos  "1" "2"
s1_T1(2) Pos  "1" "2"
---
0 0
1 0
0 1
1 1
---
1 2 "tau0"
1 2 "h10"

I want to patternmatch on ---
and get only the third part i.e.

Code:
1 2 "tau0"
1 2 "h10"

I wanted to start simple but even something like
Code:
awk '/---/{x="F"++i;}{print > x;}' file2

does not work.
Any suggestion appreciated.

Moderator's Comments:
Mod Comment edit by bakunin: please use CODE-tags for your code as well as file content and terminal output. Thank you.

Last edited by bakunin; 05-19-2014 at 12:17 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to change a particular value in a file based on a pattern

how to change a particular value in a line of a file based on a pattern eg: source file will be like ================= 99999999999 maximum number(0) ksuisikjjsl;;l skjss''llsl minimum number 0000000 maximum number of golds(0) target should be like ================= ... (9 Replies)
Discussion started by: orbeyen
9 Replies

2. Shell Programming and Scripting

listing Directory chronologically based on part of file name

hi Everbody, I had file names as shown file_01_20101104.txt file_01_20101105.txt file_02_20101104.txt file_01_20101205.txt file_03_20101104.txt file_02_20101105.txt Now i want to list them based on the date in the file name as shown... file_01_20101104.txt file_02_20101104.txt... (3 Replies)
Discussion started by: Reddy482
3 Replies

3. UNIX for Dummies Questions & Answers

Removing Part of a variable based on a pattern

Hi All, I am writing a script to work with files in a folder. The files are all in the following patterns (without quotes): "some filename - NxNN - the end.YYY" or "some filename - NNxNN - the end.YYY" Where N = a single number and YYY is the extension. Basically what I want... (5 Replies)
Discussion started by: sgtbobie
5 Replies

4. Shell Programming and Scripting

how to find pattern and discard lines before it?

Hi all, I'd like to search a file for the first occurence of the phrase "PLASTICS THAT EXPIRE" and then discard all the lines that came before it. Output the remainder to a new file. Operating system is hp-ux. I've searched for usual awk and sed one liners but can't find a solution. Thank... (4 Replies)
Discussion started by: Scottie1954
4 Replies

5. Shell Programming and Scripting

Remove part of a file based on identifiers

here below is a part of the file cat fileName.txt NAME=APP-VA-va_mediaservices-113009-VA_MS_MEDIA_SERVER_NOT_PRESENT-S FIXED=false DATE= 2013-02-19 03:46:04.4 PRIORITY=HIGH RESOURCE NAME=ccm113 NAME=APP-DS-ds_ha-140020-databaseReplicationFailure-S FIXED=false DATE= 2013-02-19... (4 Replies)
Discussion started by: vivek d r
4 Replies

6. Shell Programming and Scripting

Grep a part of file based on string identifiers

consider below file contents cat myOutputFIle.txt 8 CCM-HQE-ResourceHealthCheck: Resource List : No RED/UNKNOWN resource Health entries found ---------------------------------------------------------- 9 CCM-TraderLogin-Status: Number of logins: 0... (4 Replies)
Discussion started by: vivek d r
4 Replies

7. Shell Programming and Scripting

Splitting textfile based on pattern and name new file after pattern

Hi there, I am pretty new to those things, so I couldn't figure out how to solve this, and if it is actually that easy. just found that awk could help:(. so i have a textfile with strings and numbers (originally copy pasted from word, therefore some empty cells) in the following structure: SC... (9 Replies)
Discussion started by: luja
9 Replies

8. Shell Programming and Scripting

Finding pattern in a text file and returning a part of the word

Dear All, assume that we have a text file or a folder of files, I want to find this pattern followers*.csv in the text file , and get * as the output. There are different matches and * means every character. Thank you in advance. Best, David (1 Reply)
Discussion started by: davidfreed
1 Replies

9. UNIX for Advanced & Expert Users

Split one file to many based on pattern

Hello All, I have records in a file in a pattern A,B,B,B,B,K,A,B,B,K Is there any command or simple logic I can pull out records into multiple files based on A record? I want output as File1: A,B,B,B,B,K File2: A,B,B,K (9 Replies)
Discussion started by: deal1dealer
9 Replies

10. UNIX for Beginners Questions & Answers

Splitting a file based on a pattern

Hi All, I am having a problem. I tried to extract the chunk of data and tried to fix I am not able to. Any help please Basically I need to remove the for , values after K, this is how it is now A,, B, C,C, D,D, 12/04/10,12/04/10, K,1,1,1,1,0,3.0, K,1,1,1,2,0,4.0,... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
wxGridBagSizer(3erl)					     Erlang Module Definition					      wxGridBagSizer(3erl)

NAME
wxGridBagSizer - See external documentation: wxGridBagSizer. DESCRIPTION
See external documentation: wxGridBagSizer . This class is derived (and can use functions) from: wxFlexGridSizer wxGridSizer wxSizer DATA TYPES
wxGridBagSizer() : An object reference, The representation is internal and can be changed without notice. It can't be used for comparsion stored on disc or distributed for use on other nodes. EXPORTS
new() -> wxGridBagSizer() Equivalent to new([]) . new(Options::[Option]) -> wxGridBagSizer() Types Option = {vgap, integer()} | {hgap, integer()} See external documentation . add(This::wxGridBagSizer(), Item::wxSizerItem() (see module wxSizerItem) | wxGBSizerItem() (see module wxGBSizerItem)) -> wxSizerItem() (see module wxSizerItem) See external documentation . add(This::wxGridBagSizer(), X::integer() | term(), X::integer() | term()) -> wxSizerItem() (see module wxSizerItem) See external documentation . Alternatives: add(This::wxGridBagSizer(), Width::integer(), Height::integer()) -> add(This,Width,Height, []) add(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Pos::{R::integer(),C::integer()}) -> add(This,Win- dow,Pos, []) add(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), [Option]) -> wxSizerItem:wxSizerItem() Option = {proportion, integer()} | {flag, integer()} | {border, integer()} | {userData, wx:wx()} add(This::wxGridBagSizer(), X::integer() | term(), X::integer() | term(), X::term()) -> wxSizerItem() (see module wxSizerItem) See external documentation . Alternatives: add(This::wxGridBagSizer(), Width::integer(), Height::integer(), Pos::{R::integer(),C::integer()}) -> add(This,Width,Height,Pos, []) add(This::wxGridBagSizer(), Width::integer(), Height::integer(), [Option]) -> wxSizerItem:wxSizerItem() Option = {proportion, integer()} | {flag, integer()} | {border, integer()} | {userData, wx:wx()} add(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Pos::{R::integer(),C::integer()}, [Option]) -> wxSizerItem:wxSizerItem() Option = {span, {RS::integer(),CS::integer()}} | {flag, integer()} | {border, integer()} | {userData, wx:wx()} add(This::wxGridBagSizer(), Width::integer(), Height::integer(), Pos::{R::integer(), C::integer()}, Options::[Option]) -> wxSizerItem() (see module wxSizerItem) Types Option = {span, {RS::integer(), CS::integer()}} | {flag, integer()} | {border, integer()} | {userData, wx() (see module wx)} See external documentation . calcMin(This::wxGridBagSizer()) -> {W::integer(), H::integer()} See external documentation . checkForIntersection(This::wxGridBagSizer(), Item::wxGBSizerItem() (see module wxGBSizerItem)) -> bool() Equivalent to checkForIntersection(This, Item, []) . checkForIntersection(This::wxGridBagSizer(), X::term(), X::term()) -> bool() See external documentation . Alternatives: checkForIntersection(This::wxGridBagSizer(), Pos::{R::integer(),C::integer()}, Span::{RS::integer(),CS::integer()}) -> checkForIn- tersection(This,Pos,Span, []) checkForIntersection(This::wxGridBagSizer(), Item::wxGBSizerItem:wxGBSizerItem(), [Option]) -> bool() Option = {excludeItem, wxGBSizerItem:wxGBSizerItem()} checkForIntersection(This::wxGridBagSizer(), Pos::{R::integer(), C::integer()}, Span::{RS::integer(), CS::integer()}, Options::[Option]) -> bool() Types Option = {excludeItem, wxGBSizerItem() (see module wxGBSizerItem)} See external documentation . findItem(This::wxGridBagSizer(), Window::wxWindow() (see module wxWindow) | wxSizer() (see module wxSizer)) -> wxGBSizerItem() (see module wxGBSizerItem) See external documentation . findItemAtPoint(This::wxGridBagSizer(), Pt::{X::integer(), Y::integer()}) -> wxGBSizerItem() (see module wxGBSizerItem) See external documentation . findItemAtPosition(This::wxGridBagSizer(), Pos::{R::integer(), C::integer()}) -> wxGBSizerItem() (see module wxGBSizerItem) See external documentation . findItemWithData(This::wxGridBagSizer(), UserData::wx() (see module wx)) -> wxGBSizerItem() (see module wxGBSizerItem) See external documentation . getCellSize(This::wxGridBagSizer(), Row::integer(), Col::integer()) -> {W::integer(), H::integer()} See external documentation . getEmptyCellSize(This::wxGridBagSizer()) -> {W::integer(), H::integer()} See external documentation . getItemPosition(This::wxGridBagSizer(), X::integer() | term()) -> {R::integer(), C::integer()} See external documentation . Alternatives: getItemPosition(This::wxGridBagSizer(), Index::integer()) -> {R::integer(),C::integer()} getItemPosition(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer()) -> {R::integer(),C::integer()} getItemSpan(This::wxGridBagSizer(), X::integer() | term()) -> {RS::integer(), CS::integer()} See external documentation . Alternatives: getItemSpan(This::wxGridBagSizer(), Index::integer()) -> {RS::integer(),CS::integer()} getItemSpan(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer()) -> {RS::integer(),CS::integer()} setEmptyCellSize(This::wxGridBagSizer(), Sz::{W::integer(), H::integer()}) -> ok See external documentation . setItemPosition(This::wxGridBagSizer(), X::integer() | term(), Pos::{R::integer(), C::integer()}) -> bool() See external documentation . Alternatives: setItemPosition(This::wxGridBagSizer(), Index::integer(), Pos::{R::integer(),C::integer()}) -> bool() setItemPosition(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Pos::{R::integer(),C::integer()}) -> bool() setItemSpan(This::wxGridBagSizer(), X::integer() | term(), Span::{RS::integer(), CS::integer()}) -> bool() See external documentation . Alternatives: setItemSpan(This::wxGridBagSizer(), Index::integer(), Span::{RS::integer(),CS::integer()}) -> bool() setItemSpan(This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Span::{RS::integer(),CS::integer()}) -> bool() destroy(This::wxGridBagSizer()) -> ok Destroys this object, do not use object again AUTHORS
<> wxErlang 0.98.9 wxGridBagSizer(3erl)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy