Sponsored Content
Top Forums Shell Programming and Scripting for i in `cat myname.txt` && for y in `cat yourname.txt` Post 302255118 by danimad on Wednesday 5th of November 2008 11:55:59 PM
Old 11-06-2008
for i in `cat myname.txt` && for y in `cat yourname.txt`

cat myname.txt
John Doe I
John Doe II
John Doe III
-----------------------------------------------------------------------
for i in `cat myname.txt`
do
echo This is my name: $i >> thi.is.my.name.txt
done
-----------------------------------------------------------------------
cat thi.is.my.name.txt
This is my name: John Doe I
This is my name: John Doe II
This is my name: John Doe III
-----------------------------------------------------------------------
cat yourname.txt
Mark A
Mark B
Mark C
-----------------------------------------------------------------------
for i in `cat myname.txt` && for y in `cat yourname.txt`
do
echo This is my name: $i and this is your name: $y >> me.and.you.txt
done

The result should sound like that:

cat me.and.you.txt

This is my name: John Doe I and this is your name: Mark A
This is my name: John Doe II and this is your name: Mark B
This is my name: John Doe III and this is your name: Mark C

I don't figure it out how to use "for i in" and "for y in" at the same time to read both file lines from myname.txt and yourname.txt in the same time to put them together in one single line.
I'm a newbie but i don't want to prompt for homework problems, i would appreciate any help, even a description would be helpful, thanks.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to create & use a personal rgb.txt

Greetings -- I'm curious as to an effective way for a user (not root) to set-up a supplemental rgb.txt file for personal use on an X11 system. It's easy to set up the rgb.txt file (with only new colors) in my directory, but how can I use it in addition to the standard rgb.txt file. Thanks.... (0 Replies)
Discussion started by: slapshot_paulie
0 Replies

2. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

3. Shell Programming and Scripting

Query related to for i in `cat $TEMP_DIR/country.txt

The file country.txt contains $ cat country.txt |ORG MU| |ORG OM| WHen in script, I wrote this for i in `cat $TEMP_DIR/country.txt` It doesnot read the country file first line followed by next line Instaed it reads as |ORG in first loop and then reads MU| in next loop I want the for... (1 Reply)
Discussion started by: sureshg_sampat
1 Replies

4. Shell Programming and Scripting

cat & awk

Hi there, Can show some hit why i got this error? For eg i have a.txt in which consist of contents as below 1|781494-0015|IV\|I||C|RECHARGE|Success\|V\|\||2007-12-04 02:33:13.000| 2|762405-0405|IV\|I||C|RECHARGE|Success\|V\|\||2007-12-04 02:33:17.000| In fact , i want to perfrom to have... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

5. Shell Programming and Scripting

cat vs head vs readline get variable from txt file

I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying: c=$(head -1 somefile) echo $c which outputs correctly, but them when I do ... somecommand $c it says it can't find the file, is that because it's grabbing the whole line, and... (5 Replies)
Discussion started by: unclecameron
5 Replies

6. Shell Programming and Scripting

cat & telnet

cat & telnet hello, I need some help on using a file with the cat command. I want to set up a telnet connection with a network device with the ip-adress 10.3.0.1. Just executing the command 'telnet 10.3.0.1' gives a menu. For example, to show the help of the menu, you... (2 Replies)
Discussion started by: michealvh
2 Replies

7. UNIX for Dummies Questions & Answers

Help on cat filelist.txt |xargs -n1 find

I am trying to find all the files listed in a filelist.txt. Why cant I use something like this cat filelist.txt | xargs -n1 find $path (2 Replies)
Discussion started by: dragonpoint
2 Replies

8. Shell Programming and Scripting

Cannot open txt file in UNIX using cat utility

Hi, I am not being able to open txt files with 'cat'. One thing to mention is, the filenames start with #. I guess one can have a unix filename that starts with a special/wildcard character. I have filenames starting with @ and they are opening perfectly with cat. (5 Replies)
Discussion started by: Subhasis
5 Replies

9. UNIX for Dummies Questions & Answers

Cat Input & Output to a Log file

Team, we use below command to store the contents in a logfile. cat a.txt > a.log a.txt content is 123 345 Is there any options available to store the command used also? for eg a.log may show as cat a.txt 123 345 (5 Replies)
Discussion started by: sid2013
5 Replies
gnomevfs-cat(1) 						   User Commands						   gnomevfs-cat(1)

NAME
gnomevfs-cat - print a file to standard output using the VFS system SYNOPSIS
gnomevfs-cat URI DESCRIPTION
gnomevfs-cat prints a file to standard output using the virtual file system to access the file via a URI. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Cat a File From a Web Server example% gnomevfs-cat http://www.sun.com Example 2: Cat a Local File example% gnomevfs-cat file:///home/user/README.txt ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnomevfs-cat Executable to print a file to standard output using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-vfs | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
gnomevfs-copy(1), gnomevfs-info(1), gnomevfs-ls(1), gnomevfs-mkdir(1) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.10 6 Sep 2004 gnomevfs-cat(1)
All times are GMT -4. The time now is 08:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy