Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to read double consecutive space in filename for bash shell Post 302127359 by james_falco on Tuesday 17th of July 2007 02:13:36 PM
Old 07-17-2007
how to read double consecutive space in filename for bash shell

Hello,

Im using cygwin app which we use the bash shell for scripting.
Im trying to read a filename with consecutive spaces on the filename
ex: filename<space><space>1.txt

ls -lrt filename<space><space>1.txt is working but when I pull that from a file and place it into variable. it reads only as single space: filename<space>1.txt

ex:
cat samp.txt
output:
1:filename<space><space>2.txt
2:filename<space><space>1.txt
3:filename<space><space>3.txt

var1=`cat samp.txt |sed -n -2p |awk '{print $NF}'`
echo $var1
output:
filename<space>1.txt

Please advice how to read double consecutive spaces. Is there any escape characters?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

filename that starts with a space

I accidentally started a filename with a spce and I can not get rid of it. Any words of advice? (6 Replies)
Discussion started by: noobie_doo
6 Replies

2. Shell Programming and Scripting

Consecutive spaces within input being converted to single space

I'm reading from a file that is semi-colon delimited. One of the fields contains 2 spaces separating the first and last name (4th field in - "JOHN<space><space> DOE"): e.g. TORONTO;ONTARIO;1 YONGE STREET;JOHN DOE;CANADA When I read this record and either echo/print to screen or write to... (4 Replies)
Discussion started by: NinersFan
4 Replies

3. Shell Programming and Scripting

How to use while loop in bash shell to read a file with 4 lines of gap

Hi , I am currently using the while loop in bash shell, as follows. while read line do echo $line done < file.txt However, i want to use the while loop on file.txt, which will read the file with 4 lines of gap. Ex- if file.txt is a file of 100 lines, then i want to use the loop such... (3 Replies)
Discussion started by: jitendriya.dash
3 Replies

4. Shell Programming and Scripting

BASH Shell script - help with read

Hi all, I'm sure this is quite a simple problem, but i'm completely new to shell scripting, so bare with me. Having problems with the read command. Here's what I have: read -rp "Command to execute: " the_command ... ... echo "$the_command" ... ... eval "$the_command" Now, say, for... (8 Replies)
Discussion started by: Justin Alvarez
8 Replies

5. UNIX for Dummies Questions & Answers

filename with white space

our user creates a text file with a white space on the filename. this same file is transfered to unix via automation tool. i have a korn shell script that reads these files on a input directory and connects to oracle database to run the oracle procedures which will load the data from each of the... (2 Replies)
Discussion started by: wtolentino
2 Replies

6. Shell Programming and Scripting

Help with Disk Space script in bash shell

Hi Guys, I'm a newb at shell scripting and successfully attempted a small disk space script (victory!!) but i'm wondering whether it actually takes into consideration KB,MB,GB. Please take a look at the script and advise. ##script to check if file sys has reached threshold. ... (3 Replies)
Discussion started by: Irishboy24
3 Replies

7. UNIX for Dummies Questions & Answers

Sed- Replace space in filename by a \

`echo $file | sed 's/ / /g'` Hey guys I want help in converting the spaces in my file names to '\ ' . Example: UK maps --> UK\ maps Could someone please help me. I have tried the following sequences already (none of them work): 1)s/ /\ /g 2)s/ /\\ /g 3)s/ /\\\ /g Can someone... (7 Replies)
Discussion started by: INNSAV1
7 Replies

8. Shell Programming and Scripting

Bash only count consecutive days

I was wondering how I would go around to do this. This is an example of my output Sun Aug 21 2016 03:00:00, BLAH Mon Aug 22 2016 03:54:00, BLAH Tue Aug 23 2016 04:22:11, BLAH Thu Aug 25 2016 05:00:00, BLAH Now what I would like to do is only count CONSECUTIVE days so in the... (1 Reply)
Discussion started by: rodriguesm
1 Replies

9. UNIX for Beginners Questions & Answers

sed command to replace consecutive double quotes

I need to replace consecutive double quotes in a csv file, the data in the file is enclosed in double quotes but there are some places where the quotes are repeating Example is below Incoming data is : "Pacific Region"|"PNG"|"Jimmy""|""| Need output as: "Pacific... (10 Replies)
Discussion started by: abhilashnair
10 Replies

10. Shell Programming and Scripting

Removing consecutive double quotes

Hi I have a .csv file and when opened in notepad looks like this gggg,nnnn,"last,first","llll""",nnn So, Here I would like the ouput as below gggg,nnnn,"last,first","llll",nnn i.e replace all two double quotes into one. How could I do that? This file is being processed by another... (5 Replies)
Discussion started by: dnat
5 Replies
bdiff(1)							   User Commands							  bdiff(1)

NAME
bdiff - big diff SYNOPSIS
bdiff filename1 filename2 [n] [-s] DESCRIPTION
bdiff is used in a manner analogous to diff to find which lines in filename1 and filename2 must be changed to bring the files into agree- ment. Its purpose is to allow processing of files too large for diff. If filename1 (filename2) is -, the standard input is read. bdiff ignores lines common to the beginning of both files, splits the remainder of each file into n-line segments, and invokes diff on cor- responding segments. If both optional arguments are specified, they must appear in the order indicated above. The output of bdiff is exactly that of diff, with line numbers adjusted to account for the segmenting of the files (that is, to make it look as if the files had been processed whole). Note: Because of the segmenting of the files, bdiff does not necessarily find a smallest sufficient set of file differences. OPTIONS
n The number of line segments. The value of n is 3500 by default. If the optional third argument is given and it is numeric, it is used as the value for n. This is useful in those cases in which 3500-line segments are too large for diff, causing it to fail. -s Specifies that no diagnostics are to be printed by bdiff (silent option). Note: However, this does not suppress possible diagnostic messages from diff, which bdiff calls. USAGE
See largefile(5) for the description of the behavior of bdiff when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). FILES
/tmp/bd????? ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ SEE ALSO
diff(1), attributes(5), largefile(5) DIAGNOSTICS
Use help for explanations. SunOS 5.11 14 Sep 1992 bdiff(1)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy