The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Editing a File ramkriz Shell Programming and Scripting 1 09-19-2008 09:22 AM
file editing ambavaram Linux 0 06-24-2008 07:11 PM
editing ELF file tejuwala Linux 1 05-18-2008 12:22 AM
How to editing a txt file aaabbb123123 Shell Programming and Scripting 3 03-07-2008 12:31 AM
File editing using awk rinku11 Shell Programming and Scripting 2 11-23-2006 11:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-14-2008
subhendu81 subhendu81 is offline
Registered User
  
 

Join Date: Sep 2008
Location: mumbai
Posts: 78
file editing

hi experts,

please help me in writting the script..

i have two files file1 and file 2

i have to write a script which will take input parameters as file1 and file2

file1:
......
1
2
3
4
file2:
.....
1
2

output
........

1 file2
2 file2
3 ......
4 ......

the output must be stored in another file (either .doc or .xls)

thanks in advance

subhendu
  #2 (permalink)  
Old 10-14-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Your requirements are not clear.

What have you tried so far? Where are you stuck?
  #3 (permalink)  
Old 10-14-2008
subhendu81 subhendu81 is offline
Registered User
  
 

Join Date: Sep 2008
Location: mumbai
Posts: 78
i am trying to make it more clear

while executing the script from the command line it will take two parameters.

lets say file1 and file2

contents of file1 and file2 are

in those files data stored in columns

lets say file1 and file2 contains names as
file1
-----
1
2
3
4

file2
-----
1
2


hence the output will be

output
------
1 file2
2 file2
3 .....
4 .....

means it will search the names present in file2 in file1..

if the names presnt in file1
then it will print the file name against the names present in file1
and will put blank for other names present in file1.
  #4 (permalink)  
Old 10-14-2008
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
It sounds like homework, let us see what you have tried so far?
  #5 (permalink)  
Old 10-14-2008
subhendu81 subhendu81 is offline
Registered User
  
 

Join Date: Sep 2008
Location: mumbai
Posts: 78
just give me some idea so that i can proceed..i dont have much experience in shell scripting. but its my project requirement..
  #6 (permalink)  
Old 10-14-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Try using awk. Search the forums for FNR==NR (or NR==FNR) and the posts you find should give you some ideas.
  #7 (permalink)  
Old 10-14-2008
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
Quote:
but its my project requirement
So I was right while making a guess that its a school/homework thing.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0