Sponsored Content
Full Discussion: Remove newlines
Top Forums UNIX for Dummies Questions & Answers Remove newlines Post 302890902 by Suneelbabu.etl on Sunday 2nd of March 2014 06:35:40 AM
Old 03-02-2014
Hi Wisecracker,
i used this code
Code:
#!/bin/bash
# rm_newline.sh
cat bunny 
tr -d '\n' < bunny > NewFileName
echo ""
echo ""
cat < NewFileName
echo ""
echo ""
mynewfile=""
newline=0
n="1"
read -d  -r bunny < NewFileName
while true
do
	if [ $newline -ge ${#bunny} ]
	then
		break
	fi
	if [ "${bunny:$newline:2}" = "0$n" ]
	then
		mynewfile=$mynewfile${bunny:$newline:1}$'\n'
	else
		mynewfile=$mynewfile${bunny:$newline:1}
	fi
	newline=$[ ( $newline + 1 ) ]
done
echo "$mynewfile" > File
cat < File

but when i run this it shows some errors i.e
Code:
': No such file or directory


rm_newline.sh: line 30: syntax error: unexpected end of file

plz tel me.. here my file name is Bunny..
I beginner to shell script..
i dont have any experience to write script.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - need to remove unwanted newlines on match

Context: I need to remove unwanted newlines from a data file listing books and associated data. Here is a sample listing ( line numbers included ): 1 360762| Skip-beat! 14 /| 9781421517544| nb | 2008.| Nakamura, Yoshiki.| NAKAMUR | Kyoko Mogami followed 2 her true love Sho to Tokyo to... (6 Replies)
Discussion started by: Bubnoff
6 Replies

2. Shell Programming and Scripting

Transpose with two newlines as delimiter

Hi Guys, I have data in a file as follows: a 1 2 3 b 4 5 6 a 6 7 8 a 4 7 9 b 6 8 5 c 0 8 7 So the number of rows which have data is variable (2 for the first group, one for the second group and three for the third group), but the delimiters between the... (10 Replies)
Discussion started by: npatwardhan
10 Replies

3. Shell Programming and Scripting

Remove improperly placed newlines

Hello, there. I have a file that's a horrible, horrible mess. (Basically, it's an export from a firewall config.) The people who generated the file didn't think that putting a newline in the middle of a hostname would ever be a problem. It is. Here's an example of the stuff in the file: ... (2 Replies)
Discussion started by: mikesimone
2 Replies

4. Shell Programming and Scripting

sed remove newlines and spaces

Hi all, i am getting count from oracle 11g by spooling it to a file. Now there are some newline characters and blank spaces i need to remove these. pl provide me a awk/sed solution. the spooled file is attached. i tried this.. but not getting req o/p (6 Replies)
Discussion started by: rishav
6 Replies

5. Shell Programming and Scripting

Delete newlines after every one space

Hi All, I have a file which looks like this: abc 3456 computer 3214 printer 0.9823 computer 3214 Can anyone please let me know how I can format my text like this? abc 3456 computer 3214 printer 0.9823 computer 3214 I know how to space to newlines using tr but don't know how to do... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

6. Shell Programming and Scripting

removing newlines after a certain word.

Hello! This is my first post here. I have a file with text like: A</title> B C</title> D I need to format it to: AB CD I am trying to use sed: sed 's/<//title>\n/ /g' file > newfile to delete </title> and the newline character, but the file is unchanged because there are... (3 Replies)
Discussion started by: DaytonCPS
3 Replies

7. Shell Programming and Scripting

Need help with eliminating newlines with Perl

Good morning, I need some help with getting rid of newlines with the output from a MYSQL query and putting the information into the right format that I need. Here is the script as it is today: #!/usr/bin/perl my $uda = system("/opt/incontrol/mysql/bin/mysql -u root -ppassword... (2 Replies)
Discussion started by: brianjb
2 Replies

8. UNIX for Dummies Questions & Answers

Using find with awk to remove newlines

I want to list all html files present in a directory tree, the remove the newline and get one string with a space between files find /home/chrisd/Desktop/seg/geohtml/ -name '*.html' | awk BEGIN{FS=\r} '{print}' ---------- Post updated at 06:47 PM ---------- Previous update was at 06:25 PM... (5 Replies)
Discussion started by: kristinu
5 Replies

9. UNIX for Beginners Questions & Answers

Remove newlines and carriage return from a csv file using UNIX

I need to remove new lines and carriage returns from csv file. Is there anything other than sed and gwak by which we could achieve this ? Any suggestions ? (3 Replies)
Discussion started by: A_Gaddale
3 Replies

10. Shell Programming and Scripting

UNIX file with Newlines

Hi Friends, I have a data file with new lines. How to remove the newlines and should be showed in one line. I tried using the command tr -d '\n' filename sed 's/\n//g' file name Ex: 1 abc hyd is actual record but in our scenario showing it as 1 abc hydthis record should be like... (5 Replies)
Discussion started by: victory
5 Replies
jumpnbump(6)							   Games Manual 						      jumpnbump(6)

NAME
jumpnbump - Cute multiplayer platform game with bunnies SYNOPSIS
jumpnbump [ options... ] jumpnbump-menu DESCRIPTION
You, as a bunny, have to jump on your opponents to make them explode. It's a true multiplayer game, you can't play this alone. It has net- work support. Use the jumpnbump-menu command to launch a graphical menu allowing you to select the level and set any command line parameter. OPTIONS
-h Print help. -v Print version. -dat levelname Load levelname and use it as the level for this game. -server playercount Start as server waiting for players. -connect hostname Connect (using a network) to another person running jump'n'bump on hostname. -player num Set main player to num (0-3). Needed for networking. -fireworks Run the program in "screensaver" mode. This is useful with -fullscreen. -fullscreen Run jump'n'bump in fullscreen mode. -nosound Play without sound. -nogore Play without blood. -noflies Disable flies. -mirror Play with mirrored level. -scaleup Play with doubled resolution (800x512). -musicnosound Play with music but without sound. USAGE
The goal of the game is to jump on the other players. Each rabbit has three control keys. Player 1 (Dott) Left - Left Right - Right Jump - Up Player 2 (Jiffy) Left - A Right - D Jump - W Player 3 (Fizz) Left - J Right - L Jump - I Player 4 (Mijji) Left - 4 Right - 5 Jump - 8 In the game Turn on/off computer play (AI) of bunny 1 - 1 Turn on/off computer play (AI) of bunny 2 - 2 Turn on/off computer play (AI) of bunny 3 - 3 Turn on/off computer play (AI) of bunny 4 - 4 SECRETS
You can type these while in the game jetpack - you can fly pogostick - the bunnies keep jumping bunniesinspace - gravity is lower, you can jump higher lordoftheflies - the flies are attracted bloodisthickerthanwater - water turns to blood ADD LEVELS
You can add levels in ~/.jumpnbump/levels directory (create it if necessary). To see the added level, you have to restart jumpnbump-menu. The extension name for level is ".dat". CREATE LEVELS
There are two programs in /usr/lib/jumpnbump to help you make your own levels: pack and unpack. pack /usr/lib/jumpnbump/pack -o /tmp/newlevel.dat <file1> <file2> <file3> ... or you can just put all the files in a dir, cd to that dir and do /usr/lib/jumpnbump/pack -o /tmp/newlevel.dat * and it will put all the files in the current dir inside the packfile. Don't try things like pack -o stuff.dat ../file.c because it will add ../file.c as the filename in the packfile, which won't work. unpack /usr/lib/jumpnbump/unpack level.dat will unpack it in the current directory. gobpack With gobpack you can convert .gob files (which are sprites, described in /usr/share/doc/jumpnbump/gob.txt) into .pcx files which you can edit with The Gimp for example, then convert back to a .gob and use it in your own level. /usr/lib/jumpnbump/gobpack -u font menu.pcx will unpack font.gob using the color palette from menu.pcx and write the files font.pcx font.txt. The other gob files should use level.pcx for the correct palette. /usr/lib/jumpnbump/gobpack font will generate font.gob from font.pcx and the specifications in font.txt. The .pcx files should be resaved with another program, as they are not packed and are thus very large. AUTHORS
Chuck Mason <cemason@users.sourceforge.net>, Jon Atkins <jcatki@home.com>, Philippe Brochard <phil.brochard@wanadoo.fr>, Gurkan Sengun <tarzeau@space.ch>, and "timecop" <timecop@japan.co.jp> are the authors of jump'n'bump. This program is a UNIX port of the old DOS game by brainchilddesign. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. This manual page was written by Joe Wreschnig <piman@sacredchao.net>, for the Debian GNU/Linux system (but may be used by others). June 4th, 2006 jumpnbump(6)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy