File name has double spacing, but after print it's gone


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File name has double spacing, but after print it's gone
# 1  
Old 01-18-2011
File name has double spacing, but after print it's gone

Hi,
I am writing this script to find all files in a directory and print the filepath, date and file size.

However, it doesnt seem to preserve double spacing file with this script. I would appreciate a pointer or 2 to get around this -

Quote:
find $1 -type f -ls | awk '{for (i=11; i<=NF; i++) printf("%s ",$i); print "\t"$7"\t" $8,$9,$10;}' > $2
printf("%s ",$i) is printing the filepath, what do i need to do to make sure that unix print with double space preserved?
# 2  
Old 01-18-2011
Hi
Show us the output you are getting, and how are you expecting it to happen? Because I dont see anything specific to double spacing in the command.

Guru
# 3  
Old 01-18-2011
Oh....... this is what i meant

I have a filename

Code:
ABC  DEF.txt

And it printed with
Code:
ABC DEF.txt

# 4  
Old 01-18-2011
Why on earth would you even want a filename with two consecutive spaces in them? Plus isn't that supposed to be -printf instead of the printf you have in your awk command?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print out with equal spacing between columns?

For instance, my file contains the following content... set -A array set -A test ${array}=1 ${array}=2 ${array}=3 ${test}="Boy" ${test}="Girl" ${test}="Dog" x=0 while ;do print "${array}" " " "${test}" x=$((x+1) done... (1 Reply)
Discussion started by: TestKing
1 Replies

2. Shell Programming and Scripting

AWK print initial record and double

I have an initial record 0.018 I would like a script that would for i=0;i<200;i++ print 0.018*1 0.018*2 0.018*3 0.018*4 ... 0.018*200 using newline. (7 Replies)
Discussion started by: chrisjorg
7 Replies

3. Shell Programming and Scripting

Preserving file format and spacing in output file

Hi I have a file with the following structure "VATTENFALL GLOBAL" "Vattenfall Tray" "BARCLAYS BANK LONDON" "Capula" "P1 AGEAS GLOBAL COMPANY" "AAC - Optiver" The requirement is like this 1) Take 2 input... (16 Replies)
Discussion started by: sudeep.id
16 Replies

4. UNIX for Dummies Questions & Answers

Help with the spacing

while IFS="" read r; do printf "XXX\t%s\n" "$r" done < test1.txt > test.txt The issue is, XXX wud be a dummy column/row added to the file..But i want this XXX column to be a separated as a TAB Delimiter it should be something like XXX 1 XXX 2 (3 Replies)
Discussion started by: saggiboy10
3 Replies

5. UNIX for Dummies Questions & Answers

Converting a text file with irregular spacing into a space delimited text file?

I have a text file with irregular spacing between values which makes it really difficult to manipulate. Is there an easy way to convert it into a space delimited text file so that all the spaces, double spaces, triple spaces, tabs between numbers are converted into spaces. The file looks like this:... (5 Replies)
Discussion started by: evelibertine
5 Replies

6. Ubuntu

Inserting a header with column number to a 1.6 GB file with special spacing

Hi; I've been searching posts to find a solution to what I'm trying to do, but I've have NOT found anything yet. I have a file (file1) with 300K columns and 1411 rows, the columns don't have a column no. header (No header at all) and I'm trying to fetch the information from specific columns.... (3 Replies)
Discussion started by: sogi
3 Replies

7. Shell Programming and Scripting

print pattern within double quotes

Hi All, I have multiple lines in a file like:- "abc" def "ghi" jkl "mno" 1 I want to print in output:- abc/ghi/mno 1 How can I do this in perl? Regrds, Nilabh -----Post Update----- Additional info:- The last field of the file should be output as it is.In the above example 1 is... (6 Replies)
Discussion started by: nilabh_s
6 Replies

8. Shell Programming and Scripting

Double Spacing complex sed pipeline

my script: FILE="$1" echo "You Entered $FILE" if ; then tmp=$(cat $FILE | sed '/./!d' | sed -n '/regex/,/regex/{/regex/d;p}'| sed -n '/---/,+2!p' | sed -n '/#/!p' | sed 's/^*//' | sed -e\ s/*:// | sed -n '/==> /!p' | sed -n '/--> /!p' | sed -n '/regex/,+1!p' | sed -n '/======/!p' | sed -n... (1 Reply)
Discussion started by: omgsomuchppl
1 Replies

9. Shell Programming and Scripting

Dont want to print double-quotes

Hi, I have a perl script which generates an LDAP report in CSV Format. Issue: Some of attribute values has double-quotes as fed by users. I dont want to print those double-quotes while printing the attribute values. Please let us know how I can overcome this issue. Thank You. ... (2 Replies)
Discussion started by: gazalinawaz
2 Replies

10. UNIX for Advanced & Expert Users

How Do I rename a unix file contianing spacing?

How can I rename a unix file that has a spacing in in the charactyers? For example, I want to rename or move a file called "My OldFile.txt" to "MyNewFile.txt" or "My_New_file.txt" Please help (7 Replies)
Discussion started by: frankyranky
7 Replies
Login or Register to Ask a Question