Sponsored Content
Top Forums Shell Programming and Scripting replace '"|\n" with new line in shell script Post 302229851 by vaskarbasak on Thursday 28th of August 2008 05:10:11 AM
Old 08-28-2008
Hi,

I have a file like these format

733961132847|COM|0|0|BD|R|79.95

733961134346|COM|0|0|BD|R|34.95

807280134490|COM|0|0|BD|R|39.99

794051400123|COM|36|0|BD|R|99.98

794051415622|COM|5|0|BD|R|28.99

883929004676|COM|10|0|BD|R|28.99

883929017164|COM|5|0|BD|R|39.99

883929024087|COM|3|0|BD|R|99.98

883929026050|COM|8|0|BD|R|39.99

883929026340|COM|3|0|BD|R|179.98

but i have to make it like the format

733961132847|COM|0|0|BD|R|79.95|

733961134346|COM|0|0|BD|R|34.95|

807280134490|COM|0|0|BD|R|39.99|

794051400123|COM|36|0|BD|R|99.98
|
794051415622|COM|5|0|BD|R|28.99|

883929004676|COM|10|0|BD|R|28.99
|
883929017164|COM|5|0|BD|R|39.99|

883929024087|COM|3|0|BD|R|99.98|

883929026050|COM|8|0|BD|R|39.99|

883929026340|COM|3|0|BD|R|179.98|

pls help me.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. UNIX for Dummies Questions & Answers

shell script to replace a line contain an unkown pattern starting with "aaa, bbb"

Hello, can any one help me on this? I have a /etc/exports file, it may contain a line (I can not remember exactly). Let me use an a sample file myfile.txt which contains a line * mypattern uncertain key words I want this line (with any possible combination of the uncertain key words to be... (2 Replies)
Discussion started by: Dingrong
2 Replies

3. AIX

"too big" and "not enough memory" errors in shell script

Hi, This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies

4. Shell Programming and Scripting

Shell Script to identify the line number containing a particular "string"

Hi, I have a log file, where i am required to identify the line number, where a particular string/line appears in the log file. And then copy 200 lines above that line number to a new file. Can someone provide pointers on how to write this script or what command to be used ? Any... (2 Replies)
Discussion started by: kk2202
2 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

7. Shell Programming and Scripting

Move a line containg "char" above line containing "xchar"

Okay, so I have a rather large text file and will have to process many more and this will save me hours of work. I'm not very good at scripting, so bear with me please. Working on Linux RHEL I've been able to filter and edit and clean up using sed, but I have a problem with moving lines. ... (9 Replies)
Discussion started by: rex007can
9 Replies

8. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies

9. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
regcoords(7)							SAORD Documentation						      regcoords(7)

NAME
RegCoords - Spatial Region Coordinates SYNOPSIS
This document describes the specification of coordinate systems, and the interpretation of coordinate values, for spatial region filtering. DESCRIPTION
Pixel coordinate systems The default coordinate system for regions is PHYSICAL, which means that region position and size values are taken from the original data. (Note that this is a change from the original IRAF/PROS implementation, in which the IMAGE coordinate system was the default.) PHYSICAL coordinates always refer to pixel positions on the original image (using IRAF LTM and LTV keywords). With PHYSICAL coordinates, if a set of coordinates specifies the position of an object in an original FITS file, the same coordinates will specify the same object in any FITS derived from the original. Physical coordinates are invariant with blocking of FITS files or taking sections of images, even when a blocked section is written to a new file. Thus, although a value in pixels refers, by default, to the PHYSICAL coordinate system, you may specify that position values refer to the image coordinate system using the global or local properties commands: global coordsys image circle 512 512 100 The global command changes the coordinate system for all regions that follow, while the local command changes the coordinate system only for the region immediately following: local coordsys image circle 512 512 100 circle 1024 1024 200 This changes the coordinate system only for the region that follows. In the above example, the second region uses the global coordinate system (PHYSICAL by default). World Coordinate Systems If World Coordinate System information is contained in the data file being filtered, it also is possible to define regions using a sky coordinate system. Supported systems include: name description ---- ----------- PHYSICAL pixel coords of original file using LTM/LTV IMAGE pixel coords of current file FK4, B1950 sky coordinate systems FK5, J2000 sky coordinate systems GALACTIC sky coordinate systems ECLIPTIC sky coordinate systems ICRS currently same as J2000 LINEAR linear wcs as defined in file In addition, two mosaic coordinate systems have been defined that utilize the (evolving) IRAF mosaic keywords: name description ---- ----------- AMPLIFIER mosaic coords of original file using ATM/ATV DETECTOR mosaic coords of original file using DTM/DTV Again, to use one of these coordinate systems, the global or local properties commands are used: global coordsys galactic WCS Positions and Sizes In addition to pixels, positional values in a WCS-enabled region can be specified using sexagesimal or degrees format: position arguments description ------------------ ----------- [num] context-dependent (see below) [num]d degrees [num]r radians [num]p physical pixels [num]i image pixels [num]:[num]:[num] hms for 'odd' position arguments [num]:[num]:[num] dms for 'even' position arguments [num]h[num]m[num]s explicit hms [num]d[num]m[num]s explicit dms If ':' is used as sexagesimal separator, the value is considered to be specifying hours/minutes/seconds if it is the first argument of a positional pair, and degrees/minutes/seconds for the second argument of a pair (except for galactic coordinates, which always use degrees): argument description ----------- ----------- 10:20:30.0 10 hours, 20 minutes, 30 seconds for 1st positional argument 10 degrees, 20 minutes, 30 seconds for 2nd positional argument 10h20m30.0 10 hours, 20 minutes, 30 seconds 10d20m30.0 10 degrees, 20 minutes, 30 seconds 10.20d 10.2 degrees Similarly, the units of size values are defined by the formating character(s) attached to a number: size arguments description -------------- ----------- [num] context-dependent (see below) [num]" arc seconds [num]' arc minutes [num]d degrees [num]r radians [num]p physical pixels [num]i image pixels For example: argument description ----------- ----------- 10 ten pixels 10' ten minutes of arc 10" ten seconds of arc 10d ten degrees 10p ten pixels 0.5r half of a radian An example of using sky coordinate systems follows: global coordsys B1950 -box 175.54d 20.01156d 10' 10' local coordsys J2000 pie 179.57d 22.4d 0 360 n=4 && annulus 179.57d 22.4d 3' 24' n=5 At the FK4 1950 coordinates 175.54d RA, 20.01156d DEC exclude a 10 minute by 10 minute box. Then at the FK5 2000 coordinates 179.57d RA 22.4d DEC draw a radial profile regions pattern with 4 quadrants and 5 annuli ranging from 3 minutes to 24 minutes in diameter. In this example, the default coordinate system is overridden by the commands in the regions spec. NB - The Meaning of Pure Numbers Are Context Sensitive When a "pure number" (i.e. one without a format directive such as 'd' for 'degrees') is specified as a position or size, its interpretation depends on the context defined by the 'coordsys' keyword. In general, the rule is: All pure numbers have implied units corresponding to the current coordinate system. If no coordinate system is explicitly specified, the default system is implicitly assumed to be PHYSICAL. In practice this means that for IMAGE and PHYSICAL systems, pure numbers are pixels. Otherwise, for all systems other than LINEAR, pure numbers are degrees. For LINEAR systems, pure numbers are in the units of the linear system. This rule covers both positions and sizes. As a corollary, when a sky-formatted number is used with the IMAGE or PHYSICAL coordinate system (which includes the default case of no coordsys being specified), the formatted number is assumed to be in the units of the WCS contained in the current file. If no sky WCS is specified, an error results. Examples: circle(512,512,10) ellipse 202.44382d 47.181656d 0.01d 0.02d In the absence of a specified coordinate system, the circle uses the default PHYSICAL units of pixels, while the ellipse explicitly uses degrees, presumably to go with the WCS in the current file. global coordsys=fk5 global color=green font="system 10 normal" circle 202.44382 47.181656 0.01 circle 202.44382 47.181656 10p ellipse(512p,512p,10p,15p,20) Here, the circles use the FK5 units of degrees (except for the explicit use of pixels in the second radius), while the ellipse explicitly specifies pixels. The ellipse angle is in degrees. Note that Chandra data format appears to use "coordsys=physical" implicitly. Therefore, for most Chandra applications, valid regions can be generated safely by asking ds9 to save/display regions in pixels using the PHYSICAL coordsys. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 regcoords(7)
All times are GMT -4. The time now is 10:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy