I have a file (a minified Javascript file) that is essentially one long line.

When I run a search in this file with mc (by pressing F7 in the builtin viewer) or with less (by typing a slash) apparently it takes me to the start of the line, even though wrapping is activated. That is not helpful.

Is there a commonly available (I'm using Ubuntu) viewer that can take me to the line after wrapping where the search term was found?

  • !viewer that can take me to the line` ... you said that there is only one line
    – jsotola
    Aug 12 '21 at 23:37
  • you could use a text editor that had line-wrap capability
    – jsotola
    Aug 12 '21 at 23:38

vim's and nvi's implementations of view at least will scroll the wrapped line representation to let you see at least the start of the match (set hls in ~/.vimrc/~/.exrc to highlight searches).

Use view - to view stdin (as in seq 10000 | paste -sd ' ' - | view - as an example of viewing an overlong line)

So will the most pager (with -w to wrap) and the more implementation from util-linux.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.