Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Output a list of five books with their filename titles into one file Post 302936349 by Xcislav on Wednesday 25th of February 2015 01:36:25 AM
Old 02-25-2015
Output a list of five books with their filename titles into one file

Dear unix forum,
could I output a list of five books with their file name titles into one file?
In order o output all the contents of all the files with their file names there was:
Code:
find . -type f | while read x; echo -e "\n$x";cat "$x";done > бетховен.txt

In spite of them being successively named 1Atitle... 2Atitle the two first aren't 1A 2A, but 1A ..5A (2
3 4) They actually are: 1АБетховен.. 5АБетховен... It now breaks all things I hoped.

Could the task be done by head, cat or grep command? Cat has no file name parameter, head can't output the whole file and grep has a file name parameter but it's primary use is searching one line. In find I coulnd't write each file by hand Smilie ...

i've got another command awk '{ print FILENAME, $0 }' (it claims to show the filename though it shows it didn't end

Currently I blame the Linux learning curve because of google results and non-answered messages and all that after translation if a nice question directly to English. Isn't that it hard to make more help to design unixes language in that way to be really descriptive and write it as you think.
I'm deeply sorry for that grief!...(

Moderator's Comments:
Mod Comment edit by bakunin: please use CODE-tags for code, as required by the forum rules and refrain from excessive formatting. How is text in one-point size in light cyan against a white background supposed to be read?

Last edited by rbatte1; 02-25-2015 at 06:49 AM.. Reason: Added some ICODE tags too
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

list of books I have access to

I have another question. I have access to the books listed below, however I know that not all of them are the lates and greatest and some are over 10 years old. So the question is are most of these books still a good idea to read. Or should I try and pick up the latest and greatest editions? ... (5 Replies)
Discussion started by: bru
5 Replies

2. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

3. Solaris

A List of Solaris Books

A frequently asked question (on this forum and others) is what Solaris books are available. The quality of such books can range from downright awful to "bible-like" textbook. There are sysadmin books, kernel design books, all-in-one references and Sun certification exam books. I've put together a... (0 Replies)
Discussion started by: DraconianTimes
0 Replies

4. Shell Programming and Scripting

use input filename as an argument to name output file

I know this is a simple matter, but I'm new to this. I have a shell script that calls a sed script from within it. I want the output of the shell script to be based on the input file I pass as an argument to the original script. In other words... ./script.sh file.txt (script.sh calls sed... (2 Replies)
Discussion started by: estebandido
2 Replies

5. Shell Programming and Scripting

Output file list to array?

Hey, guys, scripting newb here. I'm trying to get a list of all .dmg files in a folder and save the output into an array. My first attempt was ARRAY= ( `ls $REIMAGEPATH | grep \.dmg$` ) However, I understand why that doesn't work now (at least I think I do). But I don't know what the... (5 Replies)
Discussion started by: nextyoyoma
5 Replies

6. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

7. Shell Programming and Scripting

File Splitter output filename

Issue: I am able to split source file in multiple files of 10 rows each but unable to get the required outputfile name. please advise. Details: input = A.txt having 44 rows required output = A_001.txt , A_002.txt and so on. Can below awk be modified to give required result current... (19 Replies)
Discussion started by: santosh2k2
19 Replies

8. Homework & Coursework Questions

Loop to Convert a list from an input file and output it to another file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: A) Write a script, which will take input from a file and convert the number from Centigrade to Fahrenheit... (5 Replies)
Discussion started by: AliTheSnake
5 Replies

9. Shell Programming and Scripting

How to remove filename from output file?

Hello, I am trying to print searched multiple keywords in multiple files. It is almost okay with the code but the code puts filename in front of each line. How may I get rid of it? -grep -A1 'word1' *.txt | grep -A1 'word2' | grep -A1 'word3' I expect: Real outcome: How may I... (3 Replies)
Discussion started by: baris35
3 Replies

10. UNIX for Beginners Questions & Answers

Insert the line number from text file to filename output

Hi everyone :) I have a file "words.txt" containing hundreds of lines of text. Each line contains a slogan. Using the code below i am able to generate an image with the slogan text from each line. The image filename is saved matching the last word on each line. Example: Line 1: We do... (2 Replies)
Discussion started by: martinsmith
2 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 11:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy