Sponsored Content
Top Forums Shell Programming and Scripting How to remove the text between all curly brackets from text file? Post 303019883 by wbport on Monday 9th of July 2018 04:47:12 PM
Old 07-09-2018
PGN is Portable Game Notation is used to record chess games. Files are a-h from the queenside to kingside, ranks are 1-8 from White's side to Black's. Pieces are uppercase KQBNR in English and are different for other languages (e.g., German is KDLST). A move or capture (has an x) not starting with an uppercase symbol is a move by a pawn. The long form includes where the piece came from and a dash before where the piece moved to--in the short form this is missing (Nf3) unless a rank or file is required to keep the move from being ambiguous (Ngf3 if there is also a knight on d2).
I'm leaving other info off for sake of brevity, but it's easy to research for those interested.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing text between two square brackets

hi guys, i'm writing a script that looks for a unquie id in a file and replaces a string between two square brackets on the same line as the unquie id: ....... ....... 0001 zz 43242 replace this text] name 0002 sd 65466 UK] country ....... ....... how can i find line with id 0001... (6 Replies)
Discussion started by: zaff
6 Replies

2. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

3. Shell Programming and Scripting

Extract text between two square [..] brackets

Hi All, After searching about this, I could find some solutions but I am not sure why it is not working in my case. I have a text file with contents between two square brackets. The text file looks like this: Use tags when you post any code so others can easily read your code. You can... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

4. Shell Programming and Scripting

Remove text between brackets

How can I use bash to remove all text between "<" and ">" in a file? (1 Reply)
Discussion started by: locoroco
1 Replies

5. Shell Programming and Scripting

Shell Variable in Curly Brackets Returns Empty Value

Hello Team, I have a script which will grep for a time from a file. I have following code to grep for a time in a file. node=`hostname` current_date=`date` file11=weblogic.log next_date=`date '+%b %e, %Y'` next_date_time11=`grep -i "${#next_date}" ${file11}| tail -1 | awk... (3 Replies)
Discussion started by: coolguyamy
3 Replies

6. Shell Programming and Scripting

Extract the text between the nth occurrence of square brackets

Please can someone help with this? I have a file with lines as follows: word1 word2 word3 word4 word5 word6 word7 word8 word1 word2 word3 word4 word5 word6 word7 word8 word1 word2 word3 word4 word5 word6 word7 word8 word1 word2 word3 word4 word5 word6 word7 word8 When I use the... (7 Replies)
Discussion started by: Subhadeep_Sahu
7 Replies

7. Shell Programming and Scripting

Remove multiline text between brackets

I have some text in a file like so This is {the first day of} my life. What I would like as output is This is my life. Any text between the curly braces is removed. In the forums I've found statements like sed 's/<*>//g' but the problem is that I think that... (12 Replies)
Discussion started by: climatron
12 Replies

8. Shell Programming and Scripting

Curly brackets converted to unicode in script

Is this a bash or wget issue? GNU bash, version 4.4.0(1)-release (x86_64-slackware-linux-gnu) GNU Wget 1.18 built on linux-gnu. If I run wget -O file localhost/{2..4} from the command line, it will download pages 2 to 4 and concatenate them to file - which is what I want. If I put this in a... (4 Replies)
Discussion started by: Ray-V
4 Replies

9. UNIX for Beginners Questions & Answers

Sort a text file based on names in square brackets

Hi all, I have a text file similar to this: Text More text Etc Stuff That Is Needed Etc Etc This contains over 70 entries and each entry has several lines of text below the name in square brackets. (5 Replies)
Discussion started by: Scally
5 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
CMAIL(6)							   Games Manual 							  CMAIL(6)

NAME
cmail - an email chess helper SYNOPSIS
cmail [options] DESCRIPTION
The cmail program will help you play chess by email with opponents of your choice using an X interface. To use it, you will need to be able to run xboard with which cmail is distributed, available by anonymous FTP from numerous sites around the world. It has been tested with xboard 3.2; it may require modification for other versions. OPTIONS
You will usually run cmail without giving any options. See the next section for instructions. -h Displays cmail usage information. -c Shows the conditions of the GNU General Public License. -w Shows the warranty notice of the GNU General Public License. -[x]v Provides or inhibits verbose output from cmail and xboard, useful for debugging. The -xv form also inhibits the cmail introduction message. -[x]mail Invokes or inhibits the sending of a mail message containing the move. -[x]xboard Invokes or inhibits the running of xboard on the game file. -[x]reuse Invokes or inhibits the reuse of an existing xboard to display the current game. -remail Resends the last mail message for that game. This inhibits running xboard. -game name The name of the game to be processed. -(w|b|)games number Number of games to start as White, as Black or in total. Default is 1 as white and none as black. If only one colour is specified then none of the other colour is assumed. If no colour is specified then equal numbers of White and Black games are started, with the extra game being as White if an odd number of total games is specified. -(me|opp) short name A one-word alias for yourself or your opponent. -(w|b|my|opp)name full name The full name of White, Black, yourself or your opponent. -(w|b|my|opp)na net address The email address of White, Black, yourself or your opponent. -dir directory The directory in which cmail keeps its files. This defaults to the environment variable $CMAIL_DIR or failing that, $CHESSDIR, $HOME/Chess or ~/Chess. It will be created if it does not exist. -arcdir directory The directory in which cmail archives completed games. Defaults to the environment variable $CMAIL_ARCDIR or, in its absence, the same directory as cmail keeps its working files (above). -mailprog mail program The program used by cmail to send email messages. This defaults to the environment variable $CMAIL_MAILPROG or failing that "/usr/ucb/Mail", "/usr/ucb/mail" or "Mail". You will need to set this variable if none of the above paths fit your system. -gamesFile file A file containing a list of games with email addresses. This defaults to the environment variable $CMAIL_GAMES or failing that .cmailgames. -aliasesFile file A file containing one or more aliases for a set of email addresses. This defaults to the environment variable $CMAIL_ALIASES or failing that .cmailaliases. -logFile file A file in which to dump verbose debugging messages that are invoked with the -v option. -event event The PGN Event tag (default "Email correspondence game"). -site site The PGN Site tag (default "NET"). -round round The PGN Round tag (default "-", not applicable). -mode mode The PGN Mode tag (default "EM", Electronic Mail). OTHER OPTIONS
Any unrecognised flags will be passed to xboard. Those most relevant for use with cmail are: -timeDelay (or -td) delay This sets the speed at which the moves are displayed on start-up. It defaults to the environment variable $CMAIL_TIME_DELAY if set, and 0 otherwise. -noChessProgram (True | False), or -[x]ncp If this option is False, xboard starts a chess program which can be used with cmail to suggest moves. Default: True. -searchTime (or -st) minutes[:seconds] Tells GNU Chess to spend at most the given amount of time searching for each of its moves. Without this option, GNU Chess chooses its search time based on the number of moves and amount of time remaining until the next time control. -searchDepth (or -sd) number Tells GNU Chess to look ahead at most the given number of moves when searching for a move to make. Without this option, GNU Chess chooses its search depth based on the number of moves and amount of time remaining until the next time control. -saveGameFile (or -sgf) file If this option is set, xboard appends a record of the game played to the specified file on exit. -autosave or -autoSaveGames If this option is True, at the end of every game xboard prompts you for a filename and appends a record of the game to the file you specify. -savePositionFile (or -spf) file If this option is set, xboard appends the final position reached to the specified file on exit. -boardSize (or -size) (Large | Medium | Small) Determines how large the board will be and what built-in piece bitmaps will be used. On a large board (the default), pieces are 80x80 pixels, on a medium board 64x64 pixels, and on a small board 40x40 pixels. STARTING A GAME
Type cmail from a shell to start a game as white. After an opening message, you will be prompted for a game name, which is optional -- if you simply press return, the game name will take the form you-VS-opponent. You will next be prompted for the short name of your opponent. If you haven't played this person before, you will also be prompted for his/her email address. cmail will then invoke xboard in the back- ground. Make your first move and select Mail Move from the File menu. If all is well, cmail will mail a copy of the move to your oppo- nent. If you select Exit without having selected Mail Move then no move will be made. ANSWERING A MOVE
When you receive a message from an opponent containing a move in one of your games, simply pipe the message through cmail. In some mailers this is as simple as typing "| cmail" when viewing the message, while in others you may have to save the message to a file and do "cmail < file" at the command line. In either case cmail will display the game using xboard. If you didn't exit xboard when you made your first move then cmail will do its best to use the existing xboard instead of starting a new one. As before, simply make a move and select Mail Move from the File menu. cmail will try to use the xboard that was most recently used to display the current game. This means that many games can be in progress simultaneously, each with its own active xboard. If you want to look at the history or explore a variation, go ahead, but you must return to the current position before xboard will allow you to mail a move. If you edit the game's history you must select Reload Same Game from the File menu to get back to the original posi- tion, then make the move you want and select Mail Move. As before, if you decide you aren't ready to make a move just yet you can either select Exit without sending a move or just leave xboard running until you are ready. COMPLETING A GAME
Because xboard can now detect checkmate and stalemate, cmail now handles game termination sensibly. As well as resignation, the Action menu now allows draws to be offered and accepted for cmail games. For multi-game messages, only unfinished and just-finished games will be included in email messages. When all the games are finished, they are archived in the user's archive directory, and similarly in the opponent's when he or she pipes the final message through cmail. The ar- chive file name includes the date the game was started. MULTI-GAME MESSAGES It's possible to have a cmail message carry more than one game. This feature was implemented to handle IECG (International Email Chess Group) matches, where a match consists of 1 game as white and 1 as black, with moves transmitted simultaneously. In case there are more general uses, cmail itself places no limit on the number of black/white games contained in a message; however, xboard does. TROUBLE SHOOTING
It's possible that a strange conjunction of conditions may occasionally mean that cmail has trouble reactivating an existing xboard. If this should happen, simply trying it again should work. If not, remove the file that stores the xboard's PID (<game>.pid) or use the -xreuse option to force cmail to start a new xboard. Versions of cmail after 2.16 no longer understand the old file format that xboard used to use and so cannot be used to correspond with any- one using an older version. Versions of cmail older than 2.11 do not handle multi-game messages, so multi-game correspondence is not possible with opponents using an older version. FILES
".cmailgames" contains a list of games with the email addresses of the opponents. ".cmailaliases" contains one or more aliases for a set of email addresses. BUGS
No known bugs. BUG REPORTS
I make no promises but if you send bug reports/suggestions to Evan.Welsh@msdw.com I'll do my best to fix/implement them. AUTHOR
Copyright (C) 1993 Free Software Foundation, Inc. cmail 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. cmail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with cmail; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. Author: Evan Welsh <Evan.Welsh@msdw.com> CONTRIBUTORS
Patrick Surry helped with design, testing and documentation. Tim Mann helped integrate cmail with xboard. SEE ALSO
Mail(1), perl(1), xboard(1) CMAIL(6)
All times are GMT -4. The time now is 02:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy