Sed- Replace space in filename by a \


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sed- Replace space in filename by a \
# 8  
Old 08-08-2013
The better alternative would be piping the output of find to a while loop and then du'ing the filenames for their sizes...
Code:
find . -type f -print | cut -c 3- | while read file
do
    size=`du -k "$file"`
    .
    .
    .
done

This also eliminates the sed command but remember to surround the variable in double quotes before using it... "$file"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace space with !@ using sed

Hello I have a requirement where I need to replace space :61 with !@ :61 Source :60F:123 :61:151 :61:151 :61:15101 Target :60F:123 :61:151!@:61:151!@:61:15101 I cant use and command as I don't want the tab to be converted . commands not working : sed 's/... (5 Replies)
Discussion started by: kamijia83
5 Replies

2. Shell Programming and Scripting

sed to replace pattern with filename

Hi all, I'm trying to replace a pattern/string in about 100 files with the filename using following commands but getting nowhere: for f in *.fa; do sed "s/^>.*/>$f/g" $f > $f_v1.fa; done for f in *.fa; do sed 's/^>.*/>`echo $f`/' > $fa_v1.fa; done Basically I want to change any line... (5 Replies)
Discussion started by: ivpz
5 Replies

3. Shell Programming and Scripting

sed the find the third , and replace with a space

Dear All, I am new here. Could anyone help to find a sed script for replace the third "," to " "? input: abc,def,ghi,jkl,mno,pqr,stu,vxz output: abc,def,ghi jkl,mno,pqr,stu,vxz Many thanks. Please use code tags next time for your code and data. (2 Replies)
Discussion started by: mimilaw
2 Replies

4. Shell Programming and Scripting

replace space with the help of sed

Hi, i have below string - mynameis arpit i want output like below - mynameis\ arpit that i am getting from below - temp='mynameis arpit' echo $temp|sed 's//\\ /g' --> mynameis\ arpit now i am doing - (2 Replies)
Discussion started by: thearpit
2 Replies

5. Shell Programming and Scripting

Replace comma with a blank space using SED

Hello everyone, I want to replace all "," (commas) with a blank space My command thus far is: cat test.text | sed -e s/\`//g | awk '{print$1" "$2" "$3}' I'm sure you guys know this, but the SED command that I am using is to get rid of the "`" (tics). which gives me: name ... (5 Replies)
Discussion started by: jayT
5 Replies

6. Shell Programming and Scripting

How to use sed to replace space partial

source "PUT 810 712 0001 ILC AK4 00 0 00 00" It needs to be changed to "PUT,810,712,0001,ILC,AK4 00 0 00 00" Thanks in advance. (6 Replies)
Discussion started by: janex
6 Replies

7. Shell Programming and Scripting

Using sed I want to replace space by newline

Input: -------------------------- 123asd 456sdasda 789a ------------------------- output wanted: --------------------- 123asd 456sdasda 789a ---------------------- I want this by sed in simple way please help (I know by: tr ' ' '\n' < inputfile )I want it by sed only (5 Replies)
Discussion started by: RahulJoshi
5 Replies

8. Shell Programming and Scripting

Replace 2 Occurances of Space (sed)

I have a large file that looks like the below output: system SUNWxwmod X Window System kernel modules system SUNWxwoft X Window System optional fonts system SUNWxwopt X Window System Optional Clients system ... (1 Reply)
Discussion started by: hxman
1 Replies

9. Shell Programming and Scripting

Replace a filename with full path using sed

hi, i need to replace a line a file with a new raw device location.. original file.. /opt/sybase/ASE1502/ASE-15_0/bin/dataserver \ -d/data/TST_AKS1/sybdevices/master.dat \ -e/logs/sybase/TST_AKS1/SFO_TST_AKS1.log \ -c/apps/sybase/ASE1502/ASE-15_0/TST_AKS1.cfg \... (2 Replies)
Discussion started by: aksaravanan
2 Replies

10. Shell Programming and Scripting

need help on sed (replace string without changing filename)

I have awhole bunch of files and I want to edit stringA with stringB without changing the filename. I have tried the following sed commands: sed "s/stringA/stringB/g" * This will print the correct results but does not actually save it with the new content of the file. when I do a cat on... (5 Replies)
Discussion started by: jjoves
5 Replies
Login or Register to Ask a Question
term::ansi::ctrl::unix(n)					 Terminal control					 term::ansi::ctrl::unix(n)

__________________________________________________________________________________________________________________________________________________

NAME
term::ansi::ctrl::unix - Control operations and queries SYNOPSIS
package require Tcl 8.4 package require term::ansi::ctrl::unix ?0.1? ::term::ansi::ctrl::unix::import ?ns? ?arg...? ::term::ansi::ctrl::unix::raw ::term::ansi::ctrl::unix::raw ::term::ansi::ctrl::unix::columns ::term::ansi::ctrl::unix::rows _________________________________________________________________ DESCRIPTION
WARNING: This package is unix-specific and depends on the availability of two unix system commands for terminal control, i.e. stty and tput, both of which have to be found in the $PATH. If any of these two commands is missing the loading of the package will fail. The package provides commands to switch the standard input of the current process between raw and cooked input modes, and to query the size of terminals, i.e. the available number of columns and lines. API
INTROSPECTION ::term::ansi::ctrl::unix::import ?ns? ?arg...? This command imports some or all attribute commands into the namespace ns. This is by default the namespace ctrl. Note that this is relative namespace name, placing the imported command into a child of the current namespace. By default all commands are imported, this can howver be restricted by listing the names of the wanted commands after the namespace argument. OPERATIONS ::term::ansi::ctrl::unix::raw This command switches the standard input of the current process to raw input mode. This means that from then on all characters typed by the user are immediately reported to the application instead of waiting in the OS buffer until the Enter/Return key is received. ::term::ansi::ctrl::unix::raw This command switches the standard input of the current process to cooked input mode. This means that from then on all characters typed by the user are kept in OS buffers for editing until the Enter/Return key is received. ::term::ansi::ctrl::unix::columns This command queries the terminal connected to the standard input for the number of columns available for display. ::term::ansi::ctrl::unix::rows This command queries the terminal connected to the standard input for the number of rows (aka lines) available for display. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category term of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
ansi, columns, control, cooked, input mode, lines, raw, rows, terminal CATEGORY
Terminal control COPYRIGHT
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net> term 0.1 term::ansi::ctrl::unix(n)