Sponsored Content
Top Forums Shell Programming and Scripting Splitting input files into multiple files through AWK command Post 302194430 by arund_01 on Tuesday 13th of May 2008 12:15:17 AM
Old 05-13-2008
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED command using multiple input files

What is the syntax to use multiple input files in a SED command. i.e. substitute a word with a phrase in every file in a directory. for every file in /usr/include that has the word "date" in the file grep -l '\<date\>' /usr/include/*.h find each occurrence of the word "time" in the file &... (3 Replies)
Discussion started by: sheoguey
3 Replies

2. Shell Programming and Scripting

how to give multiple csv files as input in awk

Hi All, I am new to shell scripting..My problem is i want to give multiple csv files as input to awk script and process the data into one file.. My input file is File1 File2 File3 Product Location Period SalesPrice A x 8/11/2010 ... (7 Replies)
Discussion started by: kvth
7 Replies

3. Shell Programming and Scripting

Splitting a file in to multiple files and passing each individual file to a command

I have an input file with contents like: MainFile.dat: 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 ... (4 Replies)
Discussion started by: rkrish
4 Replies

4. UNIX for Dummies Questions & Answers

Splitting multiple files in a folder

Hello, I am new to UNIX etc and am trying to split a large number of files, all with the extension .fas in the same folder, into smaller files wherever a string of 5ns occurs. So this file: >File1.fas nnnnnaaaaaattgattttctcagtatcgacgaatatggcgcagaaagttgaataa ... (1 Reply)
Discussion started by: Bryony
1 Replies

5. Shell Programming and Scripting

Splitting record into multiple records by appending values from an input field (AWK)

Hello, For the input file, I am trying to split those records which have multiple values seperated by '|' in the last input field, into multiple records and each record corresponds to the common input fields + one of the value from the last field. I was trying with an example on this forum... (4 Replies)
Discussion started by: imtiaz99
4 Replies

6. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

7. Shell Programming and Scripting

Splitting input CSV file into 3 files

Hi , I am receiving a CSV file that can vary in number of rows each time. I am supposed to split this file into 3 separate files like this: 1. create a file named 'File1.csv' that will contain first 3 rows of the input file 2. create file named 'File2.csv' that will contain last 3 rows of the... (7 Replies)
Discussion started by: kedrick
7 Replies

8. Shell Programming and Scripting

FOR loop with multiple files as input and awk

Hi all , i want to pass multiple files as input to a for loop for i in file1 file2 file3 do some awk action < $i >> $i.out done but im getting error in that for loop is the way i use to pass files to awk using for correct and 2.we can directly pass multiple files to awk as... (7 Replies)
Discussion started by: zozoo
7 Replies

9. Shell Programming and Scripting

[Solved] Multiple input files and output files

Hi, I have many test*.ft1 files to which I want to read as input for a script called pipe2txt.tcl and print the output in each separate file. For example, pipe2txt.tcl < test001.ft1 > test001.txt How can I read many files in this maner? thank you very much, Best, Pahuja (5 Replies)
Discussion started by: Pahuja
5 Replies

10. Open Source

Splitting files using awk and reading filename value from input data

I have a process that requires me to read data from huge log files and find the most recent entry on a per-user basis. The number of users may fluctuate wildly month to month, so I can't code for it with names or a set number of variables to capture the data, and the files are large so I don't... (7 Replies)
Discussion started by: rbatte1
7 Replies
purple-remote(1)						   User Commands						  purple-remote(1)

NAME
purple-remote - Send remote commands to Pidgin/Finch SYNOPSIS
purple-remote [-command1] [-command2] [-...] DESCRIPTION
Send remote commands to Purple. This program uses DBus to communicate with Pidgin/Finch. OPTIONS
Each command is of one of the three types: [protocol:]commandname?param1=value1=value2&... FunctionName?param1=value1=value2&... FunctionName(value1,value2,...) The second and third form are provided for completeness but their use is not recommended; use purple-send or purple-send-async instead. The second form uses introspection to find out the parameter names and their types, therefore it is rather slow. Here are some examples: jabber:goim?screenname=testone@localhost=hi jabber:gochat?room=TestRoom=conference.localhost jabber:getinfo?screenname=testone@localhost jabber:addbuddy?screenname=my friend setstatus?status=away=don't disturb quit PurpleAccountsFindConnected?name==prpl-jabber PurpleAccountFindConnected(,prpl-jabber) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-cd | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
purple-send(1), purple-send-async(1), purple-url-handler(1), attributes(5) purple-remote Manual, http://pidgin.im/ NOTES
Updated by Lei Ju, Sun Microsystems Inc., 2006, 2007. SunOS 5.11 02 Apr 2008 purple-remote(1)
All times are GMT -4. The time now is 05:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy