The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
how to rename multiple files with a single command tayyabq8 Shell Programming and Scripting 5 03-18-2008 04:04 PM
Splitting my program to multiple source files. the_learner High Level Programming 6 06-04-2007 10:53 AM
can you redirect multiple files for input? Matrix_Prime UNIX for Dummies Questions & Answers 4 02-27-2005 07:07 PM
Perform a command to multiple files mcgrawa UNIX for Dummies Questions & Answers 4 09-25-2003 04:40 AM
find files and using them as input arguements for another command bobbygrep UNIX for Dummies Questions & Answers 1 07-18-2001 05:24 AM

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

Join Date: Apr 2008
Posts: 15
Lightbulb Splitting input files into multiple files through AWK command

Hi,

I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below

for file in *.txt
do
grep -i -h "value1|value2" $file > $file;
done.

My requirment is more input values needs to be given in grep; let us say 50 values($value1,$value2.....$value50).
is there any good way of writing the code.

example
aaa 1111 ee3456
bbb 2222 bb7658
kkk 8888 nn1234
hhh 5555 bb4444
lll 9999 ee0987

Also is it possible to split the file starting from 11th position to 15th position;
becaz i want split the file by considering position from the files so that my input values will reduce. like in exapmle(there are repeted values ee bb nn bb ee etc) from the file.

is that can be achived through AWK command?

Thanks in advance.
  #2 (permalink)  
Old 05-13-2008
arund_01 arund_01 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 15
Any suggestios for the above problem?
  #3 (permalink)  
Old 05-13-2008
aju_kup aju_kup is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 189
HTML Code:
Do you want to split input file according to values?
  #4 (permalink)  
Old 05-13-2008
arund_01 arund_01 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 15
yes. I need to split the files according to given input values. Only thing is input values are almost 50. But if consider the position the input values will become less as shown below.

aaa 1111 ee3456
bbb 2222 bb7658
kkk 8888 nn1234
hhh 5555 bb4444
lll 9999 ee0987

if you aboserve the above in 3rd colomn first 2 letters are repeating. so if i consider the position (11th to 15th). i can give only 10 input values.
Sponsored Links
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 10:55 PM.


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