When I click Change All, it does it’s magic. Be sure to read the Help files for whatever program you’re using!) This is another example of how different flavors of GREP work slightly differently. (Note that TextWrangler is using backslash-number instead of the dollarsign-number code that InDesign uses. I replace it with the original paragraph style codes (\1), then use the \l code that converts the following character to lowercase, then insert the rest of the line of text (\2\3\4), leaving out the period at the end if one had been there. Which searches for any string of text that starts with the “list” paragraph style tag, followed by a single uppercase character, followed by any string of text, ending with any lowercase character that may or may not be followed by a period at the end of the paragraph. Warning: There are likely more elegant and optimized ways to write the GREP codes feel free to note your favorite ways of doing this in the comments below. Now we open the Find/Change dialog box, turn on the GREP checkbox, and type in some code. On the Mac that should probably be BBEdit or its free (but very powerful little sister) TextWrangler:Īll the paragraphs are tagged with the paragraph styles, so it’s easy to search for paragraphs that start with our “list” style. Now open that text file in a text editor that has a GREP feature. ![]() So choose File > Export, then choose InDesign Tagged Text from the Format pop-up menu. The answer, of course, is InDesign Tagged Text. The trick is to export your text in a file format that can be manipulated by GREP (text only) while also being able to re-import it without losing all your formatting. ![]() We want to make all the characters at the beginning of the list items lower case and remove the period when present. Note that some paragraphs end with a period and others don’t. Here’s my original text, formatted with automatic bullets (using a paragraph style called List): There are others, including some that can convert case. But InDesign just uses one flavor of GREP. So today the answer remains: No, you can’t do this in InDesign. As some bullet points contain several sentences, it would need to omit the full stops and capitalised sentences within the paragraphs. It would also be nice to remove the full stop at the end of the bullet point. I have 300 pages that I want to change the first character of a bullet point to lowercase. In the comments to that post, jezabellabingbong wrote: It dates from 1974 and is still going strong because we need what it does, and nothing does it better.Ĭoupling grep with some regular expressions-fu really takes it to the next level.As I mentioned back in this earlier post, InDesign’s GREP feature lacks the ability to convert found text from upper to lower case (or vice versa). Grep is a terrific tool to have at your disposal. RELATED: How to Use Pipes on Linux grep: Less a Command, More of an Ally We get a sorted listing of all the files modified in August (regardless of year), in ascending order of file size. sort 4n: Sort the output from grep on the fourth column (filesize).Note that this would also find files that have “Aug” in their names. grep “Aug”: Select the lines from the ls listing that have “Aug” in them.ls -l: Perform a long format listing of the files using ls.We’re listing the files in the current directory, selecting those with the string “Aug” in them, and sorting them by file size: ls -l | grep "Aug" | sort 4n With the next command, we’re piping the output from ls into grep and piping the output from grep into sort. ![]() Practically all of the lines within the log file will contain spaces, but we’re going to search for lines that have a space as their first character: grep "^ " geek-1.log The “^” regular expression operator matches the start of a line. We can force grep to only display matches that are either at the start or the end of a line. The -L (files without match) option does just that. The file names are listed, not the matching lines.Īnd of course, we can look for files that don’t contain the search term. To find out which C source code files contain references to the sl.h header file, use this command: grep -l "sl.h" *.c To see the names of the files that contain the search term, use the -l (files with match) option. ![]() grep -B 3 -x "20-Jan-06 15:24:35" geek-1.logĪnd to include lines from before and after the matching line use the -C (context) option. To see some lines from before the matching line, use the -B (context before) option.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |