Hello Folks ,
myfile contains 1000000 records as follows:
after run above script I got
I need it to be
I think the problem with first "sed" of mine , need to know how to remove the space between two words in double quote "String1 space String2"
Hi arm,
Please be very careful when posting your code. When I tried to run your script with the data you supplied, the output I got was:
(Note that there is a space at the end of that output. The BRE that you supplied to your first sed has two spaces after the asterisk and there aren't any occurrences of two adjacent spaces in your sample input. So I don't see how the code you showed us could have produced the output you showed us.
Assuming that there is no more than one occurrence of that field in an input line, one might also try:
which might be a little bit faster since it doesn't have to process dozens of fields that don't match.
Note also that using cat and sed as input and output filters for awk is almost always a waste of system resources that will slow down your script and may also delay other things running on your system while your script is running.
This User Gave Thanks to Don Cragun For This Post:
Hello,
I need help. I have xml file and there are one extra space on number <EpiReference>1 42345</EpiReference>. And of cource, the value change on every new file. I need remove space from that value what is in between <EpiReference> and </EpiReference>. How I can do that?
This are example... (9 Replies)
Hi,
I have file which contains following lines
A| 965.|Mr.|35.45| 66.
B| 33.| a456.| 77.
The output should be
A|965|Mr.|35.45|66
B|33| a456.|77
Basically if a Number has space in prefix and . in suffix remove both.
So pattern could be if there is a | which has next two characters as... (1 Reply)
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
Hi guys,
I am new to shell scripting and I have a small problem...If someone can solve this..that would be great
I am trying to form a XML by reading a flat file using shell scripting
This is my shell script
LINE_FILE1=`cat FLEX_FILE1.TXT | head -1 | tail -1`
echo... (1 Reply)
Hello
I have a file with data something like this in it :
texttexttext "text .lst" TEXT=" text "
texttexttext "moretext .lst" TEXT=" text "
Question is how do I get rid of space so that the files looks like this :
texttexttext "text.lst" TEXT="text"
texttexttext... (8 Replies)
Hi...
i need a script to remove the space before and after the operator like( / ).
Ex :
Input file
apple / manago
mango / fresh apple / fresh
Desired output:
apple/manago
mango/fresh apple/fresh
Note: betwee the desired operator space should be removed, between words do not remove... (3 Replies)
I have a script that shows me the disk SPace used by different dir under my home dir:
#!/bin/ksh
cd /ednpdtu3/u01/pipe
p1=`df -g | tail -1 | tr -s " " | cut -d " " -f2`
echo "Total Disk Space of Home Dir is $p1 GB"
p2=`df -g | tail -1 | tr -s " " | cut -d " " -f3`
echo "Total Disk Space... (2 Replies)