Search Results

Search found 2 results on 1 pages for 'lytithwyn'.

Page 1/1 | 1 

  • combining sed with xargs to obtain a source and output file name

    - by Lytithwyn
    I have a situation where I have some input files like this: M2U0001.MPG M2U0180.MPG And I want to run a command (in a bash shell) on each similarly named file in the directory. I'd like the current file name to be given to this command as an input and a modified version of the filename to be given as an output file. Here's an example: ffmpeg -i M2U0001.MPG M2U0001_fixed.MPG I had the idea of using xargs and sed, but this is as far as I got: ls -1 *.MPG | xargs -I{} ffmpeg -i {} `echo {} | sed -r 's/[0-9]{2,}/&_fixed/'` But this results in the original filename being output in both positions. Am I totally going about this the wrong way? I found that if I echo the filename directly to the embedded chunk like this it works: echo M2U0001.MPG | sed -r 's/[0-9]{2,}/&_fixed/'

    Read the article

  • iptables secure squid proxy

    - by Lytithwyn
    I have a setup where my incoming internet connection feeds into a squid proxy/caching server, and from there into my local wireless router. On the wan side of the proxy server, I have eth0 with address 208.78.∗∗∗.∗∗∗ On the lan side of the proxy server, I have eth1 with address 192.168.2.1 Traffic from my lan gets forwarded through the proxy transparently to the internet via the following rules. Note that traffic from the squid server itself is also routed through the proxy/cache, and this is on purpose: # iptables forwarding iptables -A FORWARD -i eth1 -o eth0 -s 192.168.2.0/24 -m state --state NEW -j ACCEPT iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A POSTROUTING -t nat -j MASQUERADE # iptables for squid transparent proxy iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.2.1:3128 iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128 How can I set up iptables to block any connections made to my server from the outside, while not blocking anything initiated from the inside? I have tried doing: iptables -A INPUT -i eth0 -s 192.168.2.0/24 -j ACCEPT iptables -A INPUT -i eth0 -j REJECT But this blocks everything. I have also tried reversing the order of those commands in case I got that part wrong, but that didn't help. I guess I don't fully understand everything about iptables. Any ideas?

    Read the article

1