Sponsored Content
Top Forums Shell Programming and Scripting Delete lines upto matching path variable Post 302460794 by Bashingaway on Thursday 7th of October 2010 03:37:28 PM
Old 10-07-2010
Delete lines upto matching path variable

I have a script that if it crashes I want it to start again where it stopped.

The way to identify the tasklist is using a find command that list all the files that need the process performed on them

Code:
TASKLIST=`find /path/to/directory -iname *.dummy | sort`

The way to identify the ones that have already been processed is

Code:
FINLIST=`find /path/to/directory -iname *.txt | sort`

So I'm then trying to delete entries in TASKLIST up to the last FINLIST entry.

Code:
LASTDONE=`echo "$FINLIST" | tail -n1 | sed 's/\.txt//'
NEWJOBS=`echo "$TASKLIST" | sed "1,/${LASTDONE}/d"

I've tried syntax ${LASTDONE} and $LASTDONE as well as sed "1,|${LASTDONE}|d" to try a different delimeter.

I keep getting unknown command errors.

Could someone please point out the probably glaringly obvious mistake I'm making so this Frenchman stops tapdancing inside my head.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete lines in file matching a pattern

I have a text file, a sample of which is as follows: r/- * 0: WINDOWS/Microsoft.NET/Framework/v2.0.50727/ASP.NETWebAdminFiles/Images/headerGRADIENT_Tall.gif r/- * 0: WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/backoff.jpg r/- * 0: ... (2 Replies)
Discussion started by: stumpyuk
2 Replies

2. Shell Programming and Scripting

delete line upto the nth occurence of a particular charachter.

hi all i want to delete a line upto a particular character. here is example. cp cms/images/wifi-zone.png i want to delete the line till . (cp cms/images/wifi-zone.) so the output wud be "png" only how can i do it? also please note down that dot (.) can also occur multiple... (12 Replies)
Discussion started by: kashifv
12 Replies

3. UNIX for Dummies Questions & Answers

sed print certain lines matching variable

I have a very large results file, and a list of filters grep -wf filterlist.txt datafile.txt > outfile.txt The above line works but is very slow and I'm wondering how to make it faster. The items in my filterlist are only relevant to the first column. I don't care if any item in the... (1 Reply)
Discussion started by: sayb
1 Replies

4. Shell Programming and Scripting

sed or awk delete character in the lines before and after the matching line

Sample file: This is line one, this is another line, this is the PRIMARY INDEX line l ; This is another line The command should find the line with “PRIMARY INDEX” and remove the last character from the line preceding it (in this case , comma) and remove the first character from the line... (5 Replies)
Discussion started by: KC_Rules
5 Replies

5. Shell Programming and Scripting

Sed delete blank lines upto first pattern match

Hi Im trying to do the following in sed. I want to delete any blank line at the start of a file until it matches a pattern and then stops. for example: Input output: I have got it to work within a range of two patterns with the following: sed '/1/,/pattern/{/^]*$/d}' The... (2 Replies)
Discussion started by: duonut
2 Replies

6. UNIX for Dummies Questions & Answers

delete lines matching a regular expression

I have a very large file (over 700 million lines) that has some lines that I need to delete. An example of 5 lines of the file: HS4_80:8:2303:19153:193032 153 k80:138891 HS4_80:8:2105:5544:43174 89 k88:81949 165 k88:81949 323 0 * = 323 0 ... (6 Replies)
Discussion started by: pathunkathunk
6 Replies

7. Shell Programming and Scripting

Display all lines after a matching variable

Hi, I have a file called abc.txt with the following dates 2016-01-27 2016-01-28 2016-01-29 2016-01-30 2016-01-31 2016-02-01 2016-02-02 2016-02-03 I would like to print all lines below if 2016-01-31 is found, excluding that date. I use this command --> sed '1,/2016-01-31/d' abc.txt If... (4 Replies)
Discussion started by: Nagesh_1985
4 Replies

8. Shell Programming and Scripting

Seemingly simple sed, delete between matching lines

There are many matching blocks of text in one file that need to be deleted. This example below is one block that needs to be either deleted or replaced with an empty line. This text below is the input file. The ouput file should be empty Searching Checks. Based on search criteria name: Value :... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies

9. Shell Programming and Scripting

Delete all lines from file matching a string

I wish to search and delete all lines in /app/Jenkins/deploy.txt having this filename string /app/Jenkins/file2.mrt as entry: I'm using : colon as delimiter in sed command as I'm dealing with file paths. Below is the command I was expecting to work. sed -i ":/app/Jenkins/file2.mrt:d"... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. UNIX for Beginners Questions & Answers

How do delete certain lines alone which are matching with start and end string values in file?

Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file: Input File format: SELECT ABCD, DEFGH,... (2 Replies)
Discussion started by: nani2019
2 Replies
Gnome2::Wnck::Tasklist(3pm)				User Contributed Perl Documentation			       Gnome2::Wnck::Tasklist(3pm)

NAME
Gnome2::Wnck::Tasklist - a tasklist widget, showing the list of windows as a list of buttons HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gnome2::Wnck::Tasklist INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODS
widget = Gnome2::Wnck::Tasklist->new ($screen) o $screen (Gnome2::Wnck::Screen) $tasklist->set_button_relief ($relief) o $relief (Gtk2::ReliefStyle) $tasklist->set_grouping_limit ($limit) o $limit (integer) $tasklist->set_grouping ($grouping) o $grouping (Gnome2::Wnck::TasklistGroupingType) $tasklist->set_icon_loader ($func, $data=undef) o $func (scalar) o $data (scalar) $tasklist->set_include_all_workspaces ($include_all_workspaces) o $include_all_workspaces (boolean) integer = $tasklist->get_minimum_height $tasklist->set_minimum_height ($size) o $size (integer) integer = $tasklist->get_minimum_width $tasklist->set_minimum_width ($size) o $size (integer) $tasklist->set_screen ($screen) o $screen (Gnome2::Wnck::Screen) list = $tasklist->get_size_hint_list Returns a list of integers. $tasklist->set_switch_workspace_on_unminimize ($switch_workspace_on_unminimize) o $switch_workspace_on_unminimize (boolean) ENUMS AND FLAGS
enum Gnome2::Wnck::TasklistGroupingType o 'never-group' / 'WNCK_TASKLIST_NEVER_GROUP' o 'auto-group' / 'WNCK_TASKLIST_AUTO_GROUP' o 'always-group' / 'WNCK_TASKLIST_ALWAYS_GROUP' enum Gtk2::ReliefStyle o 'normal' / 'GTK_RELIEF_NORMAL' o 'half' / 'GTK_RELIEF_HALF' o 'none' / 'GTK_RELIEF_NONE' SEE ALSO
Gnome2::Wnck, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container COPYRIGHT
Copyright (C) 2003-2006 by the gtk2-perl team. This software is licensed under the LGPL. See Gnome2::Wnck for a full notice. perl v5.14.2 2011-11-16 Gnome2::Wnck::Tasklist(3pm)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy