TIP: Click on subject to list as thread! ANSI
echo: fidogazette
to: Janis Kracht
from: mark lewis
date: 2019-06-27 00:00:00
subject: FidoGazette Vol 13 no 26

 On 2019 Jun 26 23:09:20, you wrote to All:

 JK>     ========Script: mvbad2tic==========
 JK>     #!/bin/sh
 JK>     list="`ls -1 *.bad`"
 JK>         for file in $list
 JK>         do
 JK>            f=`basename $file .bad`.tic
 JK>            mv $file $f
 JK>         done
 JK>     ===================================

that's pretty neat! another way it could be done is this oneliner...

ls -1 *.bad | \
  tr '\n' '\0' | \
  xargs -0 -n 1 -i basename "{}" .bad | \
  tr '\n' '\0' | \
  xargs -0 -n 1 -i echo mv "{}".bad "{}".tic

it seems convoluted but actually makes sense once you figure it out... plus it 
handles files with spaces in their names...

1. list the *.bad files one per line
2. replace newlines with nuls
3. use xargs to feed each line to basename to strip leading path and trailing 
.bad
4. replace newlines with nuls
5. use xargs to feed each line to mv (remove echo when you see it print the 
commands as you expect)

we've been using this following one with various changes depending on the 
extensions needed... it uses sed recipe for the change of extension and handles 
files with spaces, too... you just have install rename...

  rename 's/\.bad$/.pkt/' *.bad

it was very handy when first setting up the new system and traffic was already 
flowing while we were still configuring the tosser which was renaming a lot of 
pkts to bad because we were still looking up and configuring the packet 
passwords :lol:

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it 
wrong...
... "Who stole my thermal underwear?" the hunter asked coldly.
---
 
* Origin: (1:3634/12.73)

SOURCE: echomail via QWK@dmine.net

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.