LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-04-2004, 10:14 AM   #1
jago25_98
Member
 
Registered: Jun 2001
Posts: 302

Rep: Reputation: 30
Cut last 3 characters of stdin?


How do I cut the last three characters coming in from stdin?

i.e.

echo "testing 1234" |cut -b9

will do it but not when each "fdgdfgfdgdfjhlkhjhg" is used.

p.s.

Is freenode offline? (can't connect)
How can I redirect this imput into wget without writing to a file?

Code:
cat *.wvx |grep http | cut -b12- | cut ???  | wget -stdin??
 
Old 09-04-2004, 10:43 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You could use awk:
echo "testing 1234" | awk '{print substr($_,0,length($_)-3)}'

If you mean you want to pass a url to wget then use backticks:
wget `command to return url here`
 
Old 09-04-2004, 11:04 AM   #3
jago25_98
Member
 
Registered: Jun 2001
Posts: 302

Original Poster
Rep: Reputation: 30
.wmv botched answer

Managed to bodge it. Still looking for a better answer though

here's the code for anyone who wants to download .wvx files as .wmv files:

Code:
cat *.wvx |grep http | cut -b12- | sed 's/"/ /g' |awk {'print $1'} > filelist.txt && wget -i filelist.txt
You may be able to plug this into Mozilla so you have the option of downloading straight away rather than streaming one-off
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unbuffered stdin Mike Davies Linux - Software 1 03-03-2006 12:13 AM
stdout stdin Furlinastis Linux - Newbie 3 08-11-2005 11:00 PM
Statistics from stdin? edeca Linux - Software 0 05-23-2005 10:03 AM
stdin and NUL. How ? Mike Davies Linux - Software 5 10-28-2004 07:06 AM
unbuffered stdin mvt Programming 7 05-17-2004 09:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:12 AM.

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