Pattern not found in vi

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
I've got a strange problem: When I grep for a pattern (e.g. 8980) I find it in a file. But when I search for it in vi (forward or backwards) it says 'Pattern not found'.

The pattern is not broken by a linebreak in the file.

What up with dat? It's driving me bonkers...
Question by:php-newbie
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 46

Expert Comment

by:Kent Olsen
ID: 26295647
Hi newbie,

Can you post exactly what you're trying to run?


Author Comment

ID: 26296043
then either
LVL 46

Expert Comment

by:Kent Olsen
ID: 26296096
If the string "8980" is in the file, either of those commands should search for the next/previous occurence.

Are you looking for the string "8980" or a 2 character string with a hex value of "8980"?

Also, is your terminal type set correctly?
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.


Author Comment

ID: 26298776
Hi Kdo,

I can't find that string exactly when I ftp the file to windows and use a text editor to search.
I'm looking for the string 8980...
Hmm, terminal I don't set. Should I try a TERM=vt100?
But I don't see how vi would care about the terminal type?

Author Comment

ID: 26298785
sorry, my comment should say 'I can' find that string on windows...
LVL 46

Expert Comment

by:Kent Olsen
ID: 26300046
Most terminal emulators are vt100 or ANSI.  If you're using either one and there is no odd behavior other than this it's unlikely that that is the problem.

How big is the file?  Can you dump it and examine the contents?

  od -xa filename


Accepted Solution

php-newbie earned 0 total points
ID: 26383688
DOH! I missed that the vi editor opened with a message 'line too long' so it didn't load the full document

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question