473,378 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

grep end of line

3
I am trying to find a pattern at the end of a line.

I am using fedora 6, in particular gnu grep version 2.5.1.

I tried grep 'big$' filename and it returns nothing where grep '^big' filename works fine as it returns lines that start with big.

I am trying to find lines that end in big.

Help Please!

Thanks.
Jun 26 '07 #1
3 10978
ghostdog74
511 Expert 256MB
I am trying to find a pattern at the end of a line.

I am using fedora 6, in particular gnu grep version 2.5.1.

I tried grep 'big$' filename and it returns nothing where grep '^big' filename works fine as it returns lines that start with big.

I am trying to find lines that end in big.

Help Please!

Thanks.
i am more familiar with awk.
Expand|Select|Wrap|Line Numbers
  1. awk '/big$/{print}' file
  2.  
Jun 27 '07 #2
prn
254 Expert 100+
Hi pg1234,

I am trying to find a pattern at the end of a line.

I am using fedora 6, in particular gnu grep version 2.5.1.

I tried grep 'big$' filename and it returns nothing where grep '^big' filename works fine as it returns lines that start with big.

I am trying to find lines that end in big.

Help Please!

Thanks.
I don't find the same result. For example, also using FC6 and grep version 2.5.1, I have created a file bashem, consisting of the 3 lines:
Expand|Select|Wrap|Line Numbers
  1. #! /bin/bash
  2. export SOMETHING="bash"
  3. # bash this
And I get the following results (copied and pasted from a terminal window on the FC6 box):
Expand|Select|Wrap|Line Numbers
  1. $ grep bash bashem
  2. #! /bin/bash
  3. export SOMETHING="bash"
  4. # bash this
  5.  
  6. $ grep "bash$" bashem
  7. #! /bin/bash
Perhaps you could create a similarly small file and show us your results (by pasting into a "code" block).

Best Regards,
Paul
Jun 27 '07 #3
pg1234
3
I was able to get the right result when I created a file from scratch. I inherited this file and I think it has something to do with the format of the file. The file is UTF8.
Jun 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: sf | last post by:
Just started thinking about learning python. Is there any place where I can get some free examples, especially for following kind of problem ( it must be trivial for those using python) I have...
2
by: John E. Jardine | last post by:
Hi, Problem: Executing 's///' has a side effect on grep null string matching. If line 62, the substitution, is executed the last two values returned by grep and printed on lines 68, 69 are...
1
by: Al Belden | last post by:
Hi all, I've been working on a problem that I thought might be of interest: I'm trying to replace some korn shell scripts that search source code files with perl scripts to gain certain features...
3
by: David Isaac | last post by:
What's the standard replacement for the obsolete grep module? Thanks, Alan Isaac
4
by: agarwalpiyush | last post by:
Hello, I am going nuts with trying to get the following to work: This is what I intend to do: I have a line in /etc/syslog.conf which I need to delete based on ip-address provided to me in a...
13
by: Anton Slesarev | last post by:
I've read great paper about generators: http://www.dabeaz.com/generators/index.html Author say that it's easy to write analog of common linux tools such as awk,grep etc. He say that performance...
47
by: Henning_Thornblad | last post by:
What can be the cause of the large difference between re.search and grep? This script takes about 5 min to run on my computer: #!/usr/bin/env python import re row="" for a in range(156000):...
9
by: mijn naam | last post by:
Hi, I tried searching myself using google and on php.net, but too much irrelevant answers and not a single one helpful so please bare with me. Could someone please show me how to get one line...
8
by: Peter Otten | last post by:
hofer wrote: for line in open("file"): # read from file try: a, b = map(int, line.split(None, 2)) # remove extra columns, # convert to integer except ValueError: pass # remove comments,...
6
by: kronus | last post by:
Hi everyone, This is my first time posting to the UNIX form and it might be a strange request, but I believe I have most of the pieces. Here's the overall goal -- I am trying to find the links...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.