Read word after a specific word on the same line dont have space between them

how do i keep words on the same line in word?
how do you stop words from being split across two lines in word
microsoft word text jumps to next line
microsoft word hyphenation at end of line
non breaking hyphen word 2016
how to keep text from moving in word
word keep lines together not working
word keep lines together vs keep with next

How can I extract a word that comes after a specific word in bash ? More precisely, I have a file which has a line which looks like this:

Demo.txt

    IN=../files/d
    out=../files/d
    dataload
    name

i want to read "d" from above line.

sed -n '/\/files\// s~.*/files/\([^.]*\)\..*~\1~p' file

this code helping if line having "."

IN=../files/d.txt

so its printing "d"

here we have "d" without "." as end delimeter. So i want to read till end of line. i/p :

Demo.txt

IN=../files/d
    out=../files/d
    dataload
    name

output looking for:

d
d

code: in bash

You could use GNU grep with PCRE :

grep -oP '/files/\K[^.]+' file

The -P flag makes grep use PCRE, the -o makes it display only the matched part rather than the full line, and the \K in the regex omits what precedes from the displayed matched part.

Alternatively if you don't have access to GNU grep, the following perl command will have the same effect :

perl -nle 'print $& if m{/files/\K[^.]+}' file

Sample run.

Keep text together - Word - Office Support, Keep words on the same line, paragraphs on the same page, and control You can often improve the look of your document by keeping certain words and  In Word, line spacing is most commonly measured in multiples of whatever font size the paragraph is using. For example, say you’re using a 12 point font for the text in your paragraph. If you choose single line spacing, the space between lines will be 12 points. If you choose double spacing, that space between lines will be 24 points.

This sed variant should work for you:

sed -n '/\/files\// s~.*/files/\([^.]*\).*~\1~p' file

d
d

Minor change from earlier sed is that it doesn't match \. right after first capture group.

Microsoft Word Tricks to Keep Text Together, Word tips and shortcuts for document text: Microsoft Word 2013 tips, Word titles or other text that should remain together on the same line. To learn these tricks to keep text together in Microsoft Word, continue reading or if you have paragraph formatting or styles that adds space between paragraphs. More precisely, I have a file which has a single line which looks like this: I want to extract the number 100 which is after the --pe_cnt word. I cannot use sed as that works only if you want to extract an entire line.

When you don't want to think about a single command solution, you can use

grep -Eo "/files/." Demo.txt | cut -d/ -f3

Intermediate Exercises in Word Processing: Student’s Book, H E L P P O I N T S Proof Reading The word processor operator must perfect the Do not be tempted to skim the test since errors will remain undetected. When you have edited text altered by correction signs, or moved text within When proof reading, therefore, pay particular attention to line spacing between paragraphs. Kerning refers to the way spacing between two specific characters is adjusted. The idea is to give a better looking result by reducing the spacing between characters that fit together nicely (such as "A" and "V") and increasing the spacing between characters that don't. Select the text that you want to change.

Microsoft Word 2013: Introductory, Chapter Summary Enter and Edit Text Type Text (WD 5) Insert a Blank Line (WD 7) and page spacing, and print and read a all the new Word skills you have learned incorrect. flyer before formatting flyer after formatting (a) Unformatted Flyer (b) To call attention to certain words or lines, you can underline them, italicize  Click White Space Between Pages, click Add, and then click OK. The White Space Between Pages option will appear on the Quick Access Toolbar. Rest the mouse pointer over the gray area above or below a page and then click when you see the Double-click to hide white space or Double-click to show white space

Why Does Microsoft Office Give Me Such a Hard Time With Spacing , This formatting was designed to produce documents that are easy to read. But automatic spacing can be very annoying if you don't want it and don't know how to get rid of it. Microsoft Word is the only Office program with these settings. example, if you have a 10 point font size, you could set the line spacing at 12 points. To prevent overflow, word may be broken at any character. Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as value "normal" To prevent overflow, word may be broken at arbitrary points. Sets this property to its default value. Read about initial. Inherits this property from its parent

Word 2016: Line and Paragraph Spacing, Line spacing in Word 2016 can help improve readability. and make formatting decisions, you will need to consider line and paragraph spacing. From left to right, these images show default line spacing, single spacing, and double spacing. lines in your document, you can adjust spacing before and after paragraphs. I read the text file and iterate through the lines: Scanner sc = new Scanner(new File("translate.txt")); while(sc.hasNext()){ String line = sc.nextLine(); } Each line has two words. Is there any method in java to get the next word or do I have to split the line string to get the words?

Comments
  • Deepak: Please mention your full expected output in question.
  • @Deepak, so do you mean you have lines without . too? As anubhava sir mentioned please add expected output too in your post.
  • @Deepak neither -o nor -P are POSIX-specified, I guess you must not be using GNU grep. In this case I don't think there are any grep-based solutions. I'll leave my answer in case others would use it.
  • @Deepak would you happen to have perl available? According to this answer I could easily rewrite the grep -P command into a perl one.
  • @Deepak I've updated my answer to include a perl solution. Note that I haven't got any experience with perl, I just followed the linked answer's suggestions. I've added it to my sample run so I can attest it seems to work, but I can't tell if it's really good.
  • If this (or anubhava's) answer has solved your problem, please accept it :)