Sponsored Content
Top Forums Shell Programming and Scripting Grep words with spaces and save the output Post 302768487 by knijjar on Friday 8th of February 2013 04:19:29 PM
Old 02-08-2013
Grep words with spaces and save the output

I have a file that contains the schedule for a tournament with 41 teams. The team names have spaces in them. I would like to search for each teams schedule and then save that to that teams file

For example

Team name: "Team Two"

I would like to search for all the games for "Team Two" and then the result I would like to save it to a file called Team_Two

All the teams names are in a file called Teams and few of the team names have spaces in them

Code:
TeamOne
Team Two
Team Three
TeamFour
Team Five O
Team Six
Team Seven

and so on ..

Team Forty one.


Code:
$ for i in `cat teams`
do
grep -i "$i" schedule >> $i (how do I replace the space before saving it)
done

The output I would like to expect is Each teams schedule saved in their team name

This is not really urgent but can someone please help me out

Last edited by Scrutinizer; 02-08-2013 at 05:37 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Programming

How do I print(save) words to postscript?

It should be pretty simple but I'm just new to IDL and am workling through the command line and scripts(program.pro). If I want to save words to the bottom of a .ps file that I am putting a few plots in what should written in my code. set_plot works for plots but apparently not words. Print... (0 Replies)
Discussion started by: luked
0 Replies

2. Shell Programming and Scripting

Retaining spaces between words

Retaining Spaces within a word -------------------------------------------------------------------------------- Hi Experts, I have a 2 GB flat file which have unicode field, some of them are blanks and its size is 4000 character. In the existing system SED command removes the spaces.... (7 Replies)
Discussion started by: RcR
7 Replies

3. Programming

Counting characters, words, spaces, punctuations, etc.

I am very new to C programming. How could I write a C program that could count the characters, words, spaces, and punctuations in a text file? Any help will be really appreciated. I am doing this as part of my C learning exercise. Thanks, Ajay (4 Replies)
Discussion started by: ajay41aj
4 Replies

4. Shell Programming and Scripting

Save cURL verbose output to file or do it like browser "save as.."

hi there ! i have exactly the same problem like this guy here https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html i am not able to save the curl verbose output.. the sollution in this thread (redirecting stderr to a file) does not work for me.... (0 Replies)
Discussion started by: crabmeat
0 Replies

5. Shell Programming and Scripting

how can save output?

I make shell script by use "if" statement, what should add it to shell script save which I enter it in output file txt? ---------- Post updated at 08:27 AM ---------- Previous update was at 05:59 AM ---------- I mean like this echo "enter your name" read name # now i when start... (1 Reply)
Discussion started by: Oman_Member
1 Replies

6. Shell Programming and Scripting

Insert varying length spaces between words

Hey all, Fist post, so be kind... I have written an expect script which logs into a terminal and gathers several screens of information. Unfortunately the log file gives me all the special escape and control characters from the terminal. I am hoping to use a combination of shell scripting, sed,... (1 Reply)
Discussion started by: mpacer
1 Replies

7. Shell Programming and Scripting

grep words from output file

Hi, By using shell scripit i have save output in one file. I want to grep two words named CLUSTER and CLUSQMGR from that output file. How to grep that. output file would be having below words TYPE(QCLUSTER) ALTDATE(2010-05-17) CLUSTER(QS.CL.MFT1) ... (5 Replies)
Discussion started by: darling
5 Replies

8. Shell Programming and Scripting

Concatenating words without spaces.

Hi All, I have written a C program to solve this problem but I am eager to know whether the same output can be obtained using sed or awk? This is the input: star ferry computer symbol prime time This is the output: starferry ferrycomputer computersymbol symbolprime primetime (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

9. Shell Programming and Scripting

Remove spaces from between words that are in a field

Hi all, Is there a sed/awk cmd that will remove blank space from between words in a particular field, replacing with a single space? Field containing 'E's in the example below: Example input file: AAAAA AA|BBBB|CCCCCCC|DDDDDD |EEEE EEEEEE| FFF FFFFF| ... (6 Replies)
Discussion started by: dendright
6 Replies

10. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies
FAUM(1) 						       Reference Information							   FAUM(1)

NAME
faum - Small FAUmachine launcher SYNOPSIS
faum DESCRIPTION
faum is a small launcher to setup and start FAUmachine. It has no options. BUGS
Please report all bugs to info@faumachine.org[1]. FILES
$(HOME)/.faumrc Contains variables defining the default memory size, hard disk size and the location of the virtual machine. SEE ALSO
faum-node-pc(1) AUTHOR
This manual page was written by the FAUmachine Team[1]. CONTACT
Webpage[2] Project Team[1] AUTHOR
FAUmachine team COPYRIGHT
Copyright (C) 2000-2009 FAUmachine team. Developed at Friedrich Alexander University Erlangen-Nuremberg. FAUmachine comes with ABSOLUTELY NO WARRANTY. FAUmachine is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See COPYING for details. NOTES
1. info@faumachine.org mailto:info@faumachine.org 2. Webpage http://www.faumachine.org/ FAUmachine 06/21/2012 FAUM(1)
All times are GMT -4. The time now is 06:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy