{"id":1376,"date":"2009-08-14T00:33:40","date_gmt":"2009-08-14T07:33:40","guid":{"rendered":"https:\/\/edelalon.com\/blog\/?p=1376"},"modified":"2017-08-26T21:54:00","modified_gmt":"2017-08-27T04:54:00","slug":"removing-spaces-linuxmac","status":"publish","type":"post","link":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/","title":{"rendered":"Removing Spaces Linux\/Mac"},"content":{"rendered":"<p><a href=\"https:\/\/edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1378\" title=\"bash\" src=\"https:\/\/edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg\" alt=\"bash\" width=\"560\" height=\"222\" srcset=\"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg 560w, https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash-300x118.jpg 300w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n<p>I had a bunch of files I needed to upload to a web server.\u00a0 The filenames contained spaces and we know some web browsers don&#8217;t like spaces.\u00a0 There was this script I found on the web.\u00a0 It worked out really well.<\/p>\n<blockquote><p>#!\/bin\/bash<\/p>\n<p>ls &gt; \/tmp\/list<br \/>\n# we have to make the list file in a separate<br \/>\n# directory so that it doesn&#8217;t get included<br \/>\n# in the list of the current directory!<br \/>\nmv \/tmp\/list .\/list<br \/>\ncat list | tr &#8216; &#8216; &#8216;_&#8217; &gt; listnew<br \/>\n# this turns spaces into underscores<br \/>\nFILE_COUNT=$(wc -l list | awk &#8216;{print $1}&#8217;)<br \/>\nLOOP=1<br \/>\nwhile [ &#8220;$LOOP&#8221; -le &#8220;$FILE_COUNT&#8221; ]<br \/>\ndo<br \/>\nAWKFEED=&#8221;FNR==&#8221;$LOOP<br \/>\n# the command to feed awk<br \/>\n# output will be &#8216;FNR==1&#8217;, &#8216;FNR==2&#8217;, ..<br \/>\nOLDFILE=$(awk $AWKFEED list)<br \/>\nNEWFILE=$(awk $AWKFEED listnew)<br \/>\nmv &#8220;$OLDFILE&#8221; &#8220;$NEWFILE&#8221;<br \/>\n# keep the quotes to make the shell read file<br \/>\n# names with spaces as one file<br \/>\nLOOP=$(($LOOP+1))<br \/>\ndone<\/p>\n<p>rm list<br \/>\nrm listnew<\/p>\n<p>exit 0<\/p><\/blockquote>\n<p>To get this to work, create a file in the same directory. Change the mode to make sure the file is executable.<\/p>\n<p><strong>References<\/strong>:<br \/>\n<a href=\"http:\/\/www.dba-oracle.com\/t_fix_linux_data_file_names_special_characters.htm\" target=\"_blank\" rel=\"noopener\">http:\/\/www.dba-oracle.com\/t_fix_linux_data_file_names_special_characters.htm<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a bunch of files I needed to upload to a web server.\u00a0 The filenames contained spaces and we know some web browsers don&#8217;t like spaces.\u00a0 There was this script I found on the web.\u00a0 It worked out really well. #!\/bin\/bash ls &gt; \/tmp\/list # we have to make the list file in a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1378,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"tdm_status":"","tdm_grid_status":"","footnotes":""},"categories":[44,8],"tags":[218,216,217,219],"class_list":["post-1376","post","type-post","status-publish","format-standard","has-post-thumbnail","category-technology","category-tools","tag-command-line","tag-linux","tag-mac","tag-scripts"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Removing Spaces Linux\/Mac &#8226; Edel Alon<\/title>\n<meta name=\"description\" content=\"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don&#039;t forget to comment.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Removing Spaces Linux\/Mac &#8226; Edel Alon\" \/>\n<meta property=\"og:description\" content=\"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don&#039;t forget to comment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/\" \/>\n<meta property=\"og:site_name\" content=\"Edel Alon\" \/>\n<meta property=\"article:published_time\" content=\"2009-08-14T07:33:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-08-27T04:54:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"560\" \/>\n\t<meta property=\"og:image:height\" content=\"222\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Edel Alon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Edel Alon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/\"},\"author\":{\"name\":\"Edel Alon\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#\\\/schema\\\/person\\\/aaf86bfa75efb59a5f0855c63e330e42\"},\"headline\":\"Removing Spaces Linux\\\/Mac\",\"datePublished\":\"2009-08-14T07:33:40+00:00\",\"dateModified\":\"2017-08-27T04:54:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/\"},\"wordCount\":188,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#\\\/schema\\\/person\\\/aaf86bfa75efb59a5f0855c63e330e42\"},\"image\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/08\\\/bash.jpg\",\"keywords\":[\"command line\",\"linux\",\"mac\",\"scripts\"],\"articleSection\":[\"Technology\",\"Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/\",\"url\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/\",\"name\":\"Removing Spaces Linux\\\/Mac &#8226; Edel Alon\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/08\\\/bash.jpg\",\"datePublished\":\"2009-08-14T07:33:40+00:00\",\"dateModified\":\"2017-08-27T04:54:00+00:00\",\"description\":\"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don't forget to comment.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/08\\\/bash.jpg\",\"contentUrl\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/08\\\/bash.jpg\",\"width\":560,\"height\":222},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/removing-spaces-linuxmac\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Removing Spaces Linux\\\/Mac\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/\",\"name\":\"Edel Alon\",\"description\":\"Projects, Tools, Craft, Food, Music, and Other Stuff\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#\\\/schema\\\/person\\\/aaf86bfa75efb59a5f0855c63e330e42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/#\\\/schema\\\/person\\\/aaf86bfa75efb59a5f0855c63e330e42\",\"name\":\"Edel Alon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/edel-alon-logobl.png\",\"url\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/edel-alon-logobl.png\",\"contentUrl\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/edel-alon-logobl.png\",\"width\":136,\"height\":80,\"caption\":\"Edel Alon\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/edel-alon-logobl.png\"},\"description\":\"Edel-Ryan Alon is a starving musician, failed artist, connoisseur of fine foods, aspiring entrepreneur, husband, father of two, geek by day, cook by night, and an all around great guy.\",\"sameAs\":[\"https:\\\/\\\/edelalon.com\"],\"url\":\"https:\\\/\\\/www.edelalon.com\\\/blog\\\/author\\\/edelalon\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Removing Spaces Linux\/Mac &#8226; Edel Alon","description":"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don't forget to comment.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/","og_locale":"en_US","og_type":"article","og_title":"Removing Spaces Linux\/Mac &#8226; Edel Alon","og_description":"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don't forget to comment.","og_url":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/","og_site_name":"Edel Alon","article_published_time":"2009-08-14T07:33:40+00:00","article_modified_time":"2017-08-27T04:54:00+00:00","og_image":[{"width":560,"height":222,"url":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg","type":"image\/jpeg"}],"author":"Edel Alon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Edel Alon","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#article","isPartOf":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/"},"author":{"name":"Edel Alon","@id":"https:\/\/www.edelalon.com\/blog\/#\/schema\/person\/aaf86bfa75efb59a5f0855c63e330e42"},"headline":"Removing Spaces Linux\/Mac","datePublished":"2009-08-14T07:33:40+00:00","dateModified":"2017-08-27T04:54:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/"},"wordCount":188,"commentCount":0,"publisher":{"@id":"https:\/\/www.edelalon.com\/blog\/#\/schema\/person\/aaf86bfa75efb59a5f0855c63e330e42"},"image":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg","keywords":["command line","linux","mac","scripts"],"articleSection":["Technology","Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/","url":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/","name":"Removing Spaces Linux\/Mac &#8226; Edel Alon","isPartOf":{"@id":"https:\/\/www.edelalon.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#primaryimage"},"image":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg","datePublished":"2009-08-14T07:33:40+00:00","dateModified":"2017-08-27T04:54:00+00:00","description":"Hello, we have well thought out reading topics on technology, leadership, project management, food, weddings, and tools to help your daily life. Need some Excel tips or wedding planning advice? Read now and don't forget to comment.","breadcrumb":{"@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#primaryimage","url":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg","contentUrl":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2009\/08\/bash.jpg","width":560,"height":222},{"@type":"BreadcrumbList","@id":"https:\/\/www.edelalon.com\/blog\/removing-spaces-linuxmac\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edelalon.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Removing Spaces Linux\/Mac"}]},{"@type":"WebSite","@id":"https:\/\/www.edelalon.com\/blog\/#website","url":"https:\/\/www.edelalon.com\/blog\/","name":"Edel Alon","description":"Projects, Tools, Craft, Food, Music, and Other Stuff","publisher":{"@id":"https:\/\/www.edelalon.com\/blog\/#\/schema\/person\/aaf86bfa75efb59a5f0855c63e330e42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edelalon.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.edelalon.com\/blog\/#\/schema\/person\/aaf86bfa75efb59a5f0855c63e330e42","name":"Edel Alon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2017\/09\/edel-alon-logobl.png","url":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2017\/09\/edel-alon-logobl.png","contentUrl":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2017\/09\/edel-alon-logobl.png","width":136,"height":80,"caption":"Edel Alon"},"logo":{"@id":"https:\/\/www.edelalon.com\/blog\/wp-content\/uploads\/2017\/09\/edel-alon-logobl.png"},"description":"Edel-Ryan Alon is a starving musician, failed artist, connoisseur of fine foods, aspiring entrepreneur, husband, father of two, geek by day, cook by night, and an all around great guy.","sameAs":["https:\/\/edelalon.com"],"url":"https:\/\/www.edelalon.com\/blog\/author\/edelalon\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/posts\/1376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/comments?post=1376"}],"version-history":[{"count":0,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/posts\/1376\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/media\/1378"}],"wp:attachment":[{"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/media?parent=1376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/categories?post=1376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edelalon.com\/blog\/wp-json\/wp\/v2\/tags?post=1376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}