As you can see here, it outputs everything just fine expect for when it got to the name that has a space in it "checking logs". the goal here is to have that be on one line like every other name. so the output should be:
I'm not clear on what you are trying to do.
The commands:
and:
both produce exactly the same output:
So why are you wasting time putting double-quotes in an echo command that you know are going to be stripped by the shell before echo sees its arguments? Is this echo command producing output that is an accurate representation of the data that you really want the rest of this pipeline to process?
Aia,
Since the submitter doesn't want the double quotes anyway. A simpler awk script (ignoring the unneeded double-quotes in the original echo command) would be:
But, of course, this only works if the character sequence <comma><space> never appears inside a what might have been intended to be a double-quoted string in the field that is being processed by awk.
This User Gave Thanks to Don Cragun For This Post:
Under normal circumstances, i'd be quick to snatch up the awk commands that were provided so far in this thread. but in this particular case, i need a way to preserve the space between the "checking logs" and have it be on the same line as shown above.
the initial command i provided in my first post and which is also provided below is necessary in this scenario unless there's a better awk version of it that does exactly the same thing:
So, back to my suggestion, but this time preserving the double-quotes in your echo and looking for quoted, <comma><space> delimited fields:
which produces the output:
And, as before, if you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
This User Gave Thanks to Don Cragun For This Post:
Hi got this issue and was wondering if someone could please help out ?
var='." "'
echo $var
." "
I 'll get ." " and not ." with 10 spaces in between "
Thanks (3 Replies)
Hi,
I have a directory with the following file names
01 - abc hyn
02-def
03-ghi.dir
04 - jhu.dir
abc1 kil
def bil
The last two file names abc1 starts with one space and def starts with double space. I want these files in my directory to be renamed as
ABC HYN
DEF
GHI.dir... (6 Replies)
In bash or perl, I would like to know how to substitute a null character (0x00) for every white space without changing the white spaces inside the block of double quotes and the white space immediately following a backslash.
Suppose that sample.txt consists of the following line.
"b 1" c\ 2
... (2 Replies)
please somebody tell me what is wrong with this, while the thumbnail grabbing works and encoding works, but what is not working is, mv $i.jpg /var/www/thumbs/ and mv $i.mp4 /var/www/uploads/
#!/bin/bash
# MINT 9 - FFMPEG - QT-FASTSTART - X264 - MP4
DIR=/var/www/tmp
for i in... (9 Replies)
I developed a perl code..And the excerpt from it is given below...
open(HANDLE,$cmp_path) ; #reading the xml file from the file path
while($file_path = <HANDLE>)
I have list of XML files to read from a folder. It has some spaces inside the name of the file...I used "\"... (2 Replies)
Hi All,
I have spaces in between file names.
"Material Header.txt"
"Customer Header.txt"
"Vendor Header.txt"
And how can I remove spaces between file names like below
MaterialHeader.txt
CustomerHeader.txt
VendorHeader.txt
Thanks
Srimitta (10 Replies)
We ran into a problem because of a shop that uses Windows and UNIX.
The file names that Windows uses have spaces in them. When they get moved to the unix system they still have spaces. This produces a problem in our script that moves them again from one unix system to another. I've made up a... (2 Replies)
Gurus -
I got one simple TXT file with long file name with blank spaces in between the words. I am trying to display that full file name, but it breaks while displaying. Could somebody shed some light here?
Script
------
for i in `cat ~\temp\employee.txt`
do
echo $i
done (5 Replies)
The script below was written to select files and convert a particular string to something other and replace that file. However, I came across some issues with filenames that contain spaces, any suggestions to get around this? Any other suggestions that may apply to this code would also be... (5 Replies)