Sponsored Content
Top Forums Shell Programming and Scripting Echo printing a line in 2 lines; expected to print in one line Post 302927280 by linuxUser_ on Monday 1st of December 2014 10:55:49 PM
Old 12-01-2014
Echo printing a line in 2 lines; expected to print in one line

Dear All,

fileName: therm.txt
Code:
nc3h7o2h   7/27/98 thermc   3h   8o   2    0g   300.000  5000.000 1390.000    41 
 1.47017550e+01 1.71731699e-02-5.91205329e-06 9.21842570e-10-5.36438880e-14    2 
-2.99988556e+04-4.93387892e+01 2.34710908e+00 4.34517484e-02-2.65357553e-05    3 
 7.98979513e-09-9.39626069e-13-2.54265832e+04 1.79683851e+01                   4 
nc3h7o2    7/27/98 thermc   3h   7o   2    0g   300.000  5000.000 1387.000    31 
 1.23635662e+01 1.69377420e-02-5.80705297e-06 9.02805946e-10-5.24229836e-14    2 
-1.19482794e+04-3.57854035e+01 3.15306348e+00 3.52691052e-02-1.90649122e-05    3 
 5.01988372e-09-5.10606304e-13-8.35295454e+03 1.49406763e+01                   4 
c3h6ooh1-3 7/27/98 thermc   3h   7o   2    0g   300.000  5000.000 1388.000    41 
 1.45796713e+01 1.48373142e-02-5.13088443e-06 8.02513899e-10-4.68026484e-14    2 
-5.08733997e+03-4.60293044e+01 3.02841453e+00 3.90930362e-02-2.35990175e-05    3 
 6.75244193e-09-7.05929372e-13-7.99302348e+02 1.69822279e+01                   4 
c3h6ooh1-2 7/27/98 thermc   3h   7o   2    0g   300.000  5000.000 1381.000    41 
 1.43342402e+01 1.50496617e-02-5.20515993e-06 8.14227552e-10-4.74899437e-14    2 
-6.33723421e+03-4.47976591e+01 4.08359443e+00 3.40422329e-02-1.62692689e-05    3 
 2.38765400e-09 2.21650818e-13-2.27965073e+03 1.20159683e+01                   4

sedFile.sh
Code:
sed -i 's/"c3h6ooh1-2"/"LONG0001 "/g' therm.txt

What I am trying to do is simple sed operartion to replace text "c3h6ooh1-2" with "LONG0001". Strangely it is not happening.

Can somebody have a look where I am doing wrong?

Thanks & Regards,
linuxUser_
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print lines AFTER lines cointaining a regexp (or print every first and fourth line)

Hi all, This should be very easy but I can't figure it out... I have a file that looks like this: @SRR057408.1 FW8Y5CK02R652T length=34 AGCAGTGGTATCAACGCAGAGTAAGCAGTGGTAT +SRR057408.1 FW8Y5CK02R652T length=34 FIIHFF6666?=:88@@@BBD:::?@ABBAAA>8 @SRR057408.2 FW8Y5CK02TBMHV length=52... (1 Reply)
Discussion started by: kmkocot
1 Replies

2. Shell Programming and Scripting

Print (echo) variable in a single line

Hi, I have written this code ------------------------------------------------ # !/bin/ksh i=0 while do j=$i while do echo -e $j #printf "%d",$j j=`expr $j - 1` done echo i=`expr $i + 1` done ---------------------------------------------------- The ouput which... (2 Replies)
Discussion started by: rac
2 Replies

3. Shell Programming and Scripting

print - for printing whole line, but delimeters are changed to spaces

Hi consider the source file R|field1|field2 using the print statement in awk prints it as R field1 field2 Is there an easier way to print the whole line in its original format (i.e. with | delimiters) than doing print $1"|"$2"|"$3 ?? Thanks Storms (1 Reply)
Discussion started by: Storms
1 Replies

4. Shell Programming and Scripting

String search and print next all lines in one line until blank line

Dear all I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under. i/p file: A1/EXT "BSCABD1_21233G1" 757 130823 1157 RADIO X-CEIVER ADMINISTRATION BTS EXTERNAL FAULT ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

5. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

6. Shell Programming and Scripting

Printing multiple lines on the same line between specific text

This is an extract from a large file. The lines that start with fc are ports on a fabric switch. In between each fc port there is information about the port. fc2/12 is up Port description is SEIEDISCOVER-3 Speed is 4 Gbps fc2/13 is down (Administratively down) fc2/14 is up Port... (1 Reply)
Discussion started by: kieranfoley
1 Replies

7. Shell Programming and Scripting

Grep echo awk print all output on one line

Hello, I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it. I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Discussion started by: rwalker
51 Replies

8. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

9. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies

10. Shell Programming and Scripting

Echo print on same line while loop using variable

Currently using below script but echo it print the output in two line. Input file all-vm-final-2.txt CEALA08893 SDDC_SCUN DS_SIO_Workload_SAPUI_UAT_01 4 CEALA09546 SDDC_SCUN DS-SIO-PD5_Workload_UAT_SP1_Flash_07 4 CEALA09702 SDDC_SCUN DS-VSAN-RMP-WORKLOAD01 4 DEALA08762 SDDC_LDC... (3 Replies)
Discussion started by: ranjancom2000
3 Replies
UALARM(3)						   BSD Library Functions Manual 						 UALARM(3)

NAME
ualarm -- schedule signal after specified time LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> useconds_t ualarm(useconds_t useconds, useconds_t interval); DESCRIPTION
This is a simplified interface to setitimer(2). The ualarm() function waits a count of useconds before asserting the terminating signal SIGALRM. System activity or time used in processing the call may cause a slight delay. If the interval argument is non-zero, the SIGALRM signal will be sent to the process every interval microseconds after the timer expires (e.g., after useconds number of microseconds have passed). Due to a setitimer(2) restriction, the maximum number of useconds and interval is limited to 100,000,000,000,000 (in case this value fits in the unsigned integer). RETURN VALUES
When the signal has successfully been caught, ualarm() returns the amount of time left on the clock. NOTES
A microsecond is 0.000001 seconds. SEE ALSO
getitimer(2), setitimer(2), sigpause(2), sigvec(2), alarm(3), signal(3), sleep(3), usleep(3) HISTORY
The ualarm() function appeared in 4.3BSD. BSD
April 19, 1994 BSD
All times are GMT -4. The time now is 06:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy