I need a big help in a problem. I have a lot of files with the name "title" on a lot of folders. Each files have one single line and I need to copy all these lines to a new file, named "all_titles". For exemple, if I have
I want
in differents lines. One year ago I did this using the following:
Before I had a SGI IRIX, and works fine, but now I have a WindowsXP with CygWin and I get
all_title
content1content2
Itīs essential to me to get each one "content" in a single line on the new file "all_title".
Thank you for your help.
Daniel Uchoa.
Last edited by Yogesh Sawant; 04-21-2008 at 06:00 AM..
Reason: added code tags
How exactly are the files encoded? In particular, do they have DOS or Unix line endings? I'm speculating you are actually getting the same result as previously, but you are viewing it with software which doesn't understand the Unix line endings.
On Unix, each line is terminated with a line feed. On DOS, each line is terminated with the sequence carriage return, line feed.
If you need to add carriage returns, see if you have unix2dos or a similar utility. Perhaps you would like to convert the source files once and for all, and not need it in your scripts after that.
By the by, if the files are all in a subdirectory directly under the current directory, a normal wildcard should suffice.
Maybe you could use sed to add an empty line to each input file. This will produce one completely empty line if some of your files already have a proper line terminator.
Hi, I'm new here and this is my first post. I used command line Unix at work for 3 years... about 10 years ago! Now I can't figure out nor hunt down examples of how to do the following:
Say I built a list of file to backup like this:
find ~ -name "*.pdf" -print >> MYPDF.txt
So I am using find... (6 Replies)
This should recursively walk through all dirictories and
search for a specified string in all present files, if found
output manicured content (eg some regex) with CAT into
a specified directory (eg /tmp/)
one by one, keeping the original names
This is what I have so far, which seems to... (1 Reply)
I have a folder structure with multiple sub directories
MAIN
FOLDER1
SUBFOLDER1
files......
FOLDER2
SUBFOLDER1
files......
etc
and I want to find a way to create an output of every files first 20 lines. I've been searching and testing and failing. I can do it in a... (2 Replies)
Hi,
I am having trouble getting a combination of commands to work.
I need to traverse through all sub-directories of a certain directory and 'cat' the contents of a particular file in the sub-directories.
The commands on their own work but when I combine them I get no output.
The... (4 Replies)
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
Hai I just want to find a file *.txt in particular direcotry and display the file name puls the content. Do someone know hot to do this, thanks.
I try :
find test/ -name '*.txt' | xargs cat
but It does'nt print out the file name, i want something below print out in my screen :
test/1.txt... (4 Replies)
i keep getting the following error with the code segment below when i try to compile the program.
The code is from 'defs.h'
parse error before '('
parse error before ')'
stray '\' in program
this is the code segment and the error is on the second line of the segment
#define... (1 Reply)