Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Find characters between pattern in a file linux

Posted on 2016-09-01
3
Medium Priority
?
58 Views
Last Modified: 2016-09-01
I have a file containing data like

10.222.3.124 - - [31/Aug/2016:00:00:00 +0100] DELETE /artefacts/content/repositories/trs-uta-releases/com/ac/fm/sc/arsing/arsing-du/1.0.4.22/ HTTP/1.1 204 -

I wan to list characters falling between "repositories/" and "/"
like in above example , it should give me
trs-uta-releases   only
0
Comment
Question by:Ravi Raj
[X]
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
  • 2
3 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 41779559
STR='10.222.3.124 - - [31/Aug/2016:00:00:00 +0100] DELETE /artefacts/content/repositories/trs-uta-releases/com/ac/fm/sc/arsing/arsing-du/1.0.4.22/ HTTP/1.1 204 -'

echo $STR |  sed -e 's/^.*repositories\///' -e 's/\/.*//'

alternatively:

echo $STR | sed -e 's/^.*repositories\/\([^\/]*\).*/\1/'
0
 

Author Comment

by:Ravi Raj
ID: 41779565
Awesome , It worked for me, Ta!
0
 

Author Closing Comment

by:Ravi Raj
ID: 41779568
Awesome Solution
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

721 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