Sponsored Content
Top Forums Shell Programming and Scripting Working with directories, need assistance Post 302343826 by jpgleon on Thursday 13th of August 2009 06:27:35 PM
Old 08-13-2009
Working with directories, need assistance

Hello there,

I have the following issue and I need you assistance.

I have created a script that searches for directories that have spaces, for example:

./assets/en/images/pricing/current offers/SIMPLE GRID
./assets/en/images/pricing/current offers/ADVERTISED PRICE

But now the requirements have been updated and I have to rename the directory with an "_", so the result will be:

./assets/en/images/pricing/current_offers/SIMPLE_GRID
./assets/en/images/pricing/current_offers/ADVERTISED_PRICE

I have tried something like this:

mv ./assets/en/images/pricing/'current offers'/'SIMPLE GRID' ./assets/en/images/pricing/'current_offers'/'SIMPLE_GRID' but is not working.

Could you please give me a suggestion or any other idea to do this?

Thanks for the help.

Best regards

---------- Post updated at 04:27 PM ---------- Previous update was at 04:07 PM ----------

I have tried also these
find . -name '* *' | while read file;
do
target=`echo "$file" | sed 's/ /_/g'`;
echo "Renaming '$file' to '$target'";
mv "$file" "$target";
done;

But is not working

I received an error, since it replace the first found instance for example
assets/en/images/pricing/current_offers but when tries to change the second
assets/en/images/pricing/current offers/SIMPLE GRID it shows "No such file or directory"

thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to change working directories in perl?

i am new to perl. i am writing a perl script. i want to know how to change the working directories? for ex. i have a perl script in c:\proj\ . i want to run this script in this directory but i need my script to change its working directory to D:\xyz\ dynamically in the script. your help is... (1 Reply)
Discussion started by: megastar
1 Replies

2. UNIX for Dummies Questions & Answers

Listing only directories in the current working directory using the "ls" command

Hello All, I am trying to list only directories in my current directory using the command "ls -d". But the output only contains the default directory "." and doesn't list the rest of the directories in the working directory. Can anyone explain why this is happening (2 Replies)
Discussion started by: igandu
2 Replies

3. Shell Programming and Scripting

Working with multiple home directories.

I need to rename a directory in every home directory on a given workstation. I am a newb to scripting so maybe thats why I cant exactly figure out how to correctly do this. The first thing I need to be able to do to write this script is figure out how to list all the directorys (these are not... (11 Replies)
Discussion started by: trey85stang
11 Replies

4. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

5. UNIX for Advanced & Expert Users

wget assistance to manage parent directories...

looking for a wget option that does not retrieve entire path from source box... currently working with the following syntax: wget --no-verbose --mirror --no-parent --no-host-directories --page-requisites --ftp-user=mis --ftp-password=secret ftp://192.x.x.x/tmp/test is anyone familiar... (0 Replies)
Discussion started by: mr_manny
0 Replies

6. UNIX for Dummies Questions & Answers

Using grep command to find the pattern of text in all directories and sub-directories.

Hi all, Using grep command, i want to find the pattern of text in all directories and sub-directories. e.g: if i want to search for a pattern named "parmeter", i used the command grep -i "param" ../* is this correct? (1 Reply)
Discussion started by: vinothrajan55
1 Replies

7. Shell Programming and Scripting

Perl Script not working on all directories

Hi Folks, I have a script that I am using. The files are in Directory c:\files\change\options In that directory I have many other sub folders like R1 R2 R5 E4 etc... When I run this script in windows, It looks like its just changing the first folder R1 and not the rest. Can I get an... (6 Replies)
Discussion started by: richsark
6 Replies

8. Shell Programming and Scripting

Grep with Regular expression now working on file directories

Hello Everyone, I have a file sam1 with the below content SYSYSID;MANDT;/SIE/AD_Z0M_INDX;/SIE/AD_Z0M_KEY1 echo $Regex \bSYSYSID\b|\bMANDT\b|\b/SIE/AD_Z0M_INDX\b|\b/SIE/AD_Z0M_KEY1\b cat sam1 | grep -Eo $Regex I expect the result as SYSYSID MANDT /SIE/AD_Z0M_INDX /SIE/AD_Z0M_KEY1... (4 Replies)
Discussion started by: sam99
4 Replies

9. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies
PADS(8) 						      System Manager's Manual							   PADS(8)

NAME
pads - Passive Asset Detection System SYNOPSIS
pads <DhUvV> <-c file > <-d file > <-g group > <-i interface > <-n network(s) > <-p file > <-r file > <-u file > <-w file > <expression> DESCRIPTION
PADS is a libpcap based detection engine used to passively detect network assets. It is designed to complement IDS technology by providing context to IDS alerts. Goals: - Passive: Records and identifies traffic seen on a network without actively "scanning" a system. There will never be a packet sent from the pads application. - Portable: Has the ability to be placed easily on a remote system. Does not require additional external libraries other than those associated with libpcap. - Lightweight: Logging is sent to a simple CSV file. There is no need for a database or other data repository installed on the local machine. All correlation is done outside of the pads program. OPTIONS
-h Display help / usage information. -D Run PADS in the background (daemon mode). -d file Dump banner data into a libpcap formatted file. This feature will dump the matched packet or the first 4 packets of an unmatched connection into a specified file. This can be used to further identify a service and also aid with signature development. Please keep in mind that this feature must be compiled into the application in order to use it. This can be done by adding '--enable-banner-grab' to the 'configure' step. -g group This switch allows you to specify a group that PADS will drop to after the libpcap interface has been initialized. -h Display help -i interface Specify an interface to be used. -n network list Specify a set of networks to be monitored. Only assets that exist within these networks will be recorded. The networks should be specified in the following format: 10.10.10.0/24,192.168.0.0/16 . -p pid file This switch allows you to specify a PID file to be used in conjunction with daemon (-D) mode. -r file Read packets from a libpcap formatted file. -u user This switch allows you to specify a user that PADS will drop to after the libpcap interface has been initialized. -w file Dump data into a file other than assets.csv. expression selects which packets will be processed. Please see tcpdump(1) for details on the libpcap primitives. SEE ALSO
pads.conf(8), pads-report(8), pads-archiver(8), tcpdump(8), pcre(3) COPYRIGHT
Copyright (C) 2004 Matt Shelton <matt@mattshelton.com> BUGS
Please send bug reports to the author. AUTHORS
Matt Shelton <matt@mattshelton.com> 2005/06/17 PADS(8)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy