LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-16-2006, 08:36 AM   #1
ejkeebler
LQ Newbie
 
Registered: May 2004
Posts: 14

Rep: Reputation: 0
touch and input options


Basically i have a list of about 150 words, I would like to create an empty file for each word, since this is beginning to appear to be a real pain in windows, so hopefully someone can give me an idea for linux. the file that i have can be in .xls, .csv, .txt, pretty much any format if that helps at all. example file is just a list of names like jim bob, sue may, bobby joe. I would like to use it as input for touch and create empty files jimbob.txt, suemay.txt, bobbyjoe.txt or similiar.

Thanks!
 
Old 03-16-2006, 09:32 AM   #2
zeitounator
Member
 
Registered: Aug 2003
Location: Montpellier, France, Europe, World, Solar System
Distribution: Debian Sarge, Fedora core 5 (i386 and x86_64)
Posts: 262

Rep: Reputation: 30
Assuming:
- you have all your names in a txt file (called bla.txt in the example)
- all names are separated by commas and contain no other "special character" than white space
the following simple script seams a reasonable start point
Code:
#!/bin/bash

# Set Input Field Separator to 'comma'
IFS=","

# loop on each field found
for name in `cat ./bla.txt`
do
  # strip out white spaces
  filename=`echo $name | sed 's/ //g'`
  # create the file
  touch $filename.txt
done
adapt and enhance to suit your needs.

Good luck
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
One Touch backup versus One Touch II q6supvr Linux - Software 4 12-16-2007 09:28 PM
setting up language input options tsuren Slackware 4 10-27-2006 10:11 PM
Connection between Touch Screen Device Driver and /dev/input/event ... okeyla Linux - Hardware 2 03-05-2006 06:52 AM
Ctrl+Shift Unicode input gone, after installing Japanese Input Methodes polemon Linux - Newbie 1 09-20-2005 06:17 PM
Error - can't touch touch: /var/lock - filesystem problem? xanas3712 Linux - Newbie 0 05-10-2004 06:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration