LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2009, 11:35 AM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
How can I output the following lines without admin/resizer.php


I have a file.txt containing the following:
Code:
/home/the/public_html/1234213/pictures/admin/resizer.php
/home/alf/public_html/files/photos1/admin/resizer.php
/home/alf/public_html/joe/photo/admin/resizer.php
/home/alf/public_html/photos/admin/resizer.php
/home/alf/public_html/tom/gallery/admin/resizer.php
/home/st/public_html/gallery/admin/resizer.php
How can I cat that file and display the path but without admin/resizer.php?

cat file.txt | ???

TIA
 
Old 11-15-2009, 04:11 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Code:
cat infile | while read THISLINE
> do
> echo ${THISLINE%admin/resizer.php}
> done
The ${THISLINE%admin/resizer.php} strips admin/resizer.php from the original input.

Hope this helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cat: output specific number of lines mikeshn Linux - Software 8 01-24-2017 11:08 AM
how to change my printer output to 66 lines per page leroyw Linux - Enterprise 2 06-23-2007 07:54 PM
filter out lines containing specific keywords from output kpachopoulos Linux - General 2 03-12-2007 08:29 PM
output number of blank lines tjgadu Linux - Newbie 7 06-09-2005 04:01 PM
php-nuke blank admin.php zuessh Linux - Software 18 05-03-2005 07:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration