Sponsored Content
Top Forums Shell Programming and Scripting Print filenames with spaces using awk Post 302376072 by grajp002 on Monday 30th of November 2009 02:12:02 PM
Old 11-30-2009
Print filenames with spaces using awk

Hello all,
I want to list the file contents of the directory and number them. I am using la and awk to do it now,

#ls |awk '{print NR "." $1}'
1. alpha
2. beta
3. gamma

The problem I have is that some files might also have some spaces in the filenames.

#ls
alpha beta gamma some file with spaces.txt

Now I want it this way
1. alpha
2. beta
3. gamma
4. some file with spaces.txt

How do I do it?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

spaces in filenames

I have a problem with the script below #!/bin/sh for vo in `find -maxdepth 1 -type f -regex "^\./*$"` do ls -l "$vo" some other commands done It works fine until `find ...` returns files with spaces. I've tryed to change IFS but haven't succeed Any solutions? (4 Replies)
Discussion started by: Hitori
4 Replies

2. Shell Programming and Scripting

How to print arguments along with spaces using awk

Hi All, file_1.txt contains aaa bbbb hhhh vvvvv mmmmm iiiii What i want is to search for the first coloumn of each line using awk.i.e as below: awk '/aaa/ {printf(<>)}' file_1.txt The print part (<>) should contain all the values(or coloumns ) in the particular line(here it... (8 Replies)
Discussion started by: jisha
8 Replies

3. Shell Programming and Scripting

awk help with find command and filenames with spaces

I have the following code: find /usr/local/test5 -type f -mtime +30 -exec ls -l {} \; | awk '{print $5, $6, $7, $8, $9}' I have this as output: 14 Aug 12 00:00 /usr/local/test5/file1 14 Aug 12 00:00 /usr/local/test5/lastname, The bolded part is where I run into trouble. The actual... (4 Replies)
Discussion started by: streetfighter2
4 Replies

4. Shell Programming and Scripting

How to print the last column of the list contain filenames with spaces.

Hi experts, I have the following data: I want the last filed in the output. How to print the last field , It contains the file names and few filenames with white spaces . -rw-r--r-- 1 root root 0 2010-04-26 16:57 file1 2space_File.txt -rw-r--r-- 1 root root 0 2010-04-26... (2 Replies)
Discussion started by: rveri
2 Replies

5. Shell Programming and Scripting

awk and spaces in filenames

Hey there, this is my first post and I'll try to explain my situation as best I can.Here is a sample of the input file: ADO Sample.h,v ADO Sample 2010-05-21 lyonsb /repository/patents/TSCommon/OpenSource/Dundass/ug6mfc/DataSources/Ado/ADO Sample ADO SampleDoc.h,v ADO SampleDoc 2010-05-21... (3 Replies)
Discussion started by: rodan90
3 Replies

6. Shell Programming and Scripting

[awk] print all filenames in directory

Hello, I was given a (I suppose) a simple task which I don't know how to do. Before coming here I have read a dozen of awk tutorials (full read, not just line-skipping) but I still don't know how to do this. Task: Write an script file 'check.awk' with a parameter current directory that... (5 Replies)
Discussion started by: c0dehunter
5 Replies

7. UNIX for Dummies Questions & Answers

Print files with spaces using awk

When I use: find . -ls | awk 'BEGIN { OFS = ";"} {print $1,$2,$11}'I get a nice result, yet the files with spaces in it show only the first word and all other characters after the blank space are not printed. e.g. 'file with a blank space' is printed file 'file_with a blank space' is... (7 Replies)
Discussion started by: dakke
7 Replies

8. UNIX for Dummies Questions & Answers

AWK print last field including SPACES

I have simple test.sh script, see below: bill_code=`echo $record | awk -F"|" '{print $1}'` Fullname=`echo $record | awk -F"|" '{print $3}'` email=`echo $record | awk -F\ '{print $4}'` The last field contains spaces: see csv below: A0222|Y|DELACRUZ|-cc dell@yahoo.com-cc support@yahoo.com ... (9 Replies)
Discussion started by: quay
9 Replies

9. Shell Programming and Scripting

awk - print columns with text and spaces

Hi, I'm using awk to print columns from a tab delimited text file: awk '{print " "$2" "$3" $6"}' file The problem I have is column 6 contains text with spaces etc which means awk only prints the first word. How can I tell awk to print the whole column content as column 6? Thanks, (10 Replies)
Discussion started by: keenboy100
10 Replies

10. Shell Programming and Scripting

awk print string with removing all spaces

Hi all, I want to set 10 set of strings into a variable where: removing all spaces within each string change the delimiter from "|" to "," Currently, I've the below script like this:Table=`ten character strings with spaces in-between and each string with delimiter "|" | tr -d ' ' |... (7 Replies)
Discussion started by: o1283c
7 Replies
MPSCNNNormalizationGammaAndBetaState(3) 		 MetalPerformanceShaders.framework		   MPSCNNNormalizationGammaAndBetaState(3)

NAME
MPSCNNNormalizationGammaAndBetaState SYNOPSIS
#import <MPSCNNNormalizationWeights.h> Inherits MPSState. Instance Methods (nonnull instancetype) - initWithGamma:beta: Class Methods (nonnull instancetype) + temporaryStateWithCommandBuffer:numberOfFeatureChannels: Properties __nonnull id< MTLBuffer > gamma __nonnull id< MTLBuffer > beta Method Documentation - (nonnull instancetype) initWithGamma: (__nonnull id< MTLBuffer >) gamma(__nonnull id< MTLBuffer >) beta Initialize a MPSCNNNormalizationGammaAndBetaState object using values contained in MTLBuffers. Parameters: gamma The MTLBuffer containing gamma terms. beta The MTLBuffer containing beta terms. + (nonnull instancetype) temporaryStateWithCommandBuffer: (__nonnull id< MTLCommandBuffer >) commandBuffer(NSUInteger) numberOfFeatureChannels Create a temporary MPSCNNNormalizationGammaAndBetaState suitable for a normalization operation on images containing no more than the specified number of feature channels. Parameters: commandBuffer The command buffer on which the temporary state will be used. numberOfFeatureChannels The number of feature channels used to size the state. Property Documentation - beta [read], [nonatomic], [assign] A MTLBuffer containing the beta terms. - gamma [read], [nonatomic], [assign] A MTLBuffer containing the gamma terms. Author Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code. Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNNormalizationGammaAndBetaState(3)
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy