LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 01-05-2005, 01:25 PM   #1
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Rep: Reputation: 45
get file contents with newlines into bash variable


Dear all:

Is it possible to get contents of a text file into the bash variable so that newlines are not deleted?

OR

Is there a better way to get a listing of directory where selected file/subdir names are excluded? Currently I do full listing, exclude selected names by sed, and then use the result.

OR

Are there better ways for excluding files/dirs from 'mkisfs'? '--exclude-list' seems promising, but can I use it together with graft-points? Currently I construct the list of included files and add every single diectory with corresponding graftpoint:
Code:
mkisofs -graft-points file1 dir1=dir1 ...
Otherwise I lose the first-level directories.

Thanks in advance

Ott
 
Old 01-06-2005, 09:43 AM   #2
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
[zeropash@xyz]$ dirlist=`ls -l y`
[zeropash@xyz]$ echo $dirlist
total 0 -rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file1 -rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file2 -rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file3
[zeropash@xyz]$ echo "$dirlist"
total 0
-rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file1
-rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file2
-rw-rw-r-- 1 rprakash rprakash 0 Jan 6 21:11 file3

---
OR

[zeropash@xyz]$ cat list_to_exclude
file2
[zeropash@xyz]$ ls y
file1
file2
file3
[zeropash@xyz]$ ls y>list
[zeropash@xyz]$ comm -3 list list_to_exclude
file1
file2

-----
OR
No Idea

Last edited by zeropash; 01-06-2005 at 11:06 AM.
 
Old 01-06-2005, 01:23 PM   #3
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Original Poster
Rep: Reputation: 45
Thanks 8-),

I was not aware of 'comm'.

Best,

Ott
 
  


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
same system variable, but with different contents? kpachopoulos Linux - General 1 07-31-2005 05:15 PM
Bash: Supress newlines with \c - Doesn't work stefanlasiewski Programming 5 07-26-2005 01:17 PM
Split a string on newlines (bash) rose_bud4201 Programming 7 04-14-2005 01:58 PM
[JAVA - JLabel] executing a method based on contents of the variable linux_ub Programming 1 08-12-2004 09:50 AM
Bash - Using variable from a .conf file steevy18 Programming 1 10-28-2003 11:58 AM


All times are GMT -5. The time now is 06:12 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration