![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
sed command line help
I'm trying to get this sed command to work correctly. I need to retrieve a specific "string" from: terms_id=string&location
below is what i'm working with so far. Code:
sed -ne 's/^.*terms_id=\([^&]*\)&.*$/\1/' |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 | ||
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,372
|
whats wrong with it?
test.txt Quote:
Quote:
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
hmm I noticed that you removed -ne, it works without that. also is there a way to make it append the outputs each time the command is run? it seems to be writing a new file each time I run the command. thanks
Code:
sed 's/^.*terms_id=\([^&]*\)&.*$/\1/' test.txt > getIDs.txt |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Coupon Guru
Industry Role:
Join Date: Mar 2009
Location: Minneapolis
Posts: 10,973
|
Quote:
__________________
Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more! AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
thanks Fris and CYF
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
back with another question. it keeps grabbing all the html coding around the string. I can see that its finding the string in the output but its also grabbing the html coding content as well.
Code:
#! /bin/sh if [ $# -ne 2 ]; then echo "usage: $0 termfile baseurl" >&2 exit 1 fi termfile="$1" baseurl="$2" while read term; do wget -q -O- "$baseurl/server.php?all=$term" | sed 's/^.*terms_id=\([^&]*\)&.*$/\1/' done < "$termfile" |
![]() |
![]() ![]() ![]() ![]() ![]() |