Skip to main content
June 9, 2017
Answered

Delete a line that includes a certain name

  • June 9, 2017
  • 4 replies
  • 1065 views

Hi,

I import a list of names everyday from excel into indesign and would like to whittle the list down of people who are no longer with the company. Is there find/change command I can set up to delete the whole line that a certain name appears on? In the example below, is there a way to delete Rob's entire line (rob's line shows up in multiple spots so that is why I would prefer something I can run everyday rather than deleting it manually)? Since they are coming in from excel, each line ends with a paragraph break and the values are separated by tabs. Thank you in advance for any help you can give. 

Joe     0     0     0

Tom     0     0     0

Rob     0     0     0

Ben     0     0     0   

Mary     0     0     0

    This topic has been closed for replies.
    Correct answer Erica Gamet

    Oh, okay...and I think we are going about this in too complicated a manner. If you want their entire line erased, try this (for John Doe and Erica Gamet's info):

    ^(John Doe|Erica Gamet).+\r

    Change to: leave blank

    That says to delete John Doe's or Erica Gamet's info at the beginning of a line.

    4 replies

    JonathanArias
    Legend
    June 9, 2017

    looks liek you have 4 colums, ad a fith and add a number 1 next to the name you want to remove, do a sort and than delete all of the 1?

    Community Expert
    June 9, 2017

    If it's coming in via Excel why not do a Data Merge.

    https://indesignsecrets.com/automating-data-handling.php

    Erica Gamet
    Inspiring
    June 9, 2017

    Above, I did it for Tom and Rob's line both...just put all the names in that first group, separated by a 'pipe' for it to grab the names you want to delete.

    June 9, 2017

    Hi Erica,

    Thank you so much for your quick response. I didn't realize Grep was the way to do it and that you would tailor your answer to my data. My data is actually a little different than my example. It's a first name and last separated by a space and then 10 more categories which are separated by tabs and have a different numerical value each day. For example:

    John Doe(tab).000(tab).000(tab).000(tab)12(tab)3(tab)4(tab)54(tab)567(tab)0(tab)0(paragraph break)

    Does that change the grep expression?

    MW Design
    Inspiring
    June 9, 2017

    Replace the spaces in the provided grep with the grep tab command. Copy and paste the grep into the grep find box, delete a space and use the flout to insert the tab string. Do it to the other spaces.

    Why isn't the excel file cleaned up so thus is even needed? If because it is now laid out, I would recommend doing it for the future.

    Erica Gamet
    Inspiring
    June 9, 2017

    You could do a GREP expression. You have a series of non-breaking spaces and one spacebar space before each value. Try:

    (Tom|Rob)~S{4} \d~S{4} \d~S{4} \d

    And replace with nothing...you'll still have a hard return, though...which you could use the built-in multiple return to single return to clean that up.