Sponsored Content
Top Forums Shell Programming and Scripting Changing Special Characters Using Sed Post 40442 by cstovall on Monday 15th of September 2003 03:47:41 PM
Old 09-15-2003
Question Changing Special Characters Using Sed

Hi. Does anyone know how to use the sed command to change the special border characters on this .per file. I have to edit about 80 .per files. I need a sed script to change the below 3 and A characters.


ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Test Islands, Office of Public Health -- WIC Computer Support System 1.0 ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³
³ C L I N I C M A I N M E N U ³
³ ³
³ 1 - Create/Update Patient 10 - Voucher Maintenance ³
³ 2 - WIC Case Maintenance 11 - Display Patient Events ³
³ 3 - WIC Case Data Sheet 12 - View Patient Medical Records ³
³ 4 - 13 - Written Manual Voucher Entry ³
³ 5 - Edit Patient Food Package 14 - WIC Case Inquiry ³
³ 6 - Record Patient Event/Sched 15 - Record Group Education Events ³
³ 7 - 16 - ³
³ 8 - Register Nutritional Ed 17 - Schedule Patients ³
³ 9 - Discharge Clients 18 - Show Family Relationships ³
³ ³
³ Q - Quit From System ³
³ ³
³ Enter Number of Selection: [a1] ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed with special characters

i have this script that searches for a pattern. However it fails if the pattern includes some special characters. So far, it fails with the following strings: 1. -Cr 2. $Mj 3. H'412 would a sed or awk be more effective? i don't want the users to put the (\) during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies

2. Shell Programming and Scripting

sed with special characters

Hi, I am reading a file (GC_JAR.log) which has entries like: 511725.629, 0.1122672 secs] 525268.975, 0.1240036 secs] 527181.835, 0.2068215 secs] 527914.287, 0.2884801 secs] 528457.134, 0.2548725 secs] I want to replace all the entries of "secs]" with just "secs" Thus, the output... (4 Replies)
Discussion started by: itzz.me
4 Replies

3. Shell Programming and Scripting

sed with many special characters

I started with this: counter1=1 cp file.txt file_${counter1}.tmp while read name1 do echo $name1 counter2=`expr $counter1 + 1` sed /'${name1}'/d file_${counter1}.txt > file_${counter2}.txt counter1=`expr $counter1 + 1` done < source.txtsource.txt contains the... (1 Reply)
Discussion started by: lakanino
1 Replies

4. Shell Programming and Scripting

Using sed to replace special characters

Hi everyone I have file1 contains: '7832' ' 8765 6543 I want a sed command that will format as: '7832' , '8765' , '6543' I tried sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2 sed -e :a -e '$!N; s/\n/ /; ta' file2 which gives: 7832 8765 6543 I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies

5. Shell Programming and Scripting

SED with Special characters

Hello All Seeking the right one SED command. My attempt is: From orginal.txt by SED to target.txt sed -i "/('outbound-callerid/a\$ext->add($context, $exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:${CALLERID(nummer)}@carrier.com>'));" orginal.txtWhat am make wrong?:wall: ... (5 Replies)
Discussion started by: mdbinder
5 Replies

6. Shell Programming and Scripting

Escape special characters in SED

Need help in escaping special characters in sed command. Here is the the string which i am trying to find a replace with From :- REQUEST_TYPE=PIXEL&amp;MSG_ID={//MESSAGE_ID} To :- REQUEST_TYPE=PIXEL&amp;MSG_ID= X_EDELIVERY_MESSAGE_ID &amp; BATCH_ID= X_EDELIVERY_BATCH_ID Here is the sed command i am... (2 Replies)
Discussion started by: aakishore
2 Replies

7. Shell Programming and Scripting

sed special characters issue

Hi I'm trying to replace string1 by string2 in file homepage.htm as follows but is not working. Please Help: sedsed -i "s@'://your server name:port/test/owa'@'://11.22.33.44:5555/pls/SAMPLE'@g" homepage.htm Where, String1 ://your server name:port/test/owa String2... (3 Replies)
Discussion started by: koazter
3 Replies

8. Shell Programming and Scripting

Sed - remove special characters

Hi, I have a file with this line, it's always in the first line: I want to remove these special characters: ´╗┐ file1 ´╗┐\\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35 Bytes;2 ;1 I want the same file to be only \\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35... (4 Replies)
Discussion started by: nakaedu
4 Replies

9. Shell Programming and Scripting

sed special characters issues

I am dusting off the sed cobwebs and had a basic question: I have a file that contains: $firewall = "on"; $cache = "on"; $dataset{'mary had a little lamb'} = "on"; and want to only change the contents of what is between the single quotes: $dataset{'big bad wolf'} = "on"; I... (3 Replies)
Discussion started by: metallica1973
3 Replies

10. Shell Programming and Scripting

sed in a while loop with special characters

I have the foolowing data file: File1 <p name="A">5004</p> <p name="B">5004</p> <p name="C">5004</p> <p name="A">15004</p> <p name="B">15004</p> <p name="C">15004</p> In a while loop using sed (100 of line need to be replace), I need the output to File3:... (2 Replies)
Discussion started by: bobo
2 Replies
gdcmscu(1)							       GDCM								gdcmscu(1)

NAME
gdcmscu - Tool to execute a DICOM Query/Retrieve operation SYNOPSIS
gdcmscu [OPTION]...[OPERATION]...HOSTNAME...[PORT]... Execute a DICOM Q/R operation to HOSTNAME, using port PORT (104 when not specified) DESCRIPTION
The gdcmscu command line program is the tool to execute DICOM Query/Retrieve operation. It supports: o C-ECHO (SCU) o C-FIND (SCU) o C-STORE (SCU) o C-MOVE (SCU/SCP) C-MOVE operation are executed using two different ports (one for the SCU and one for the SCP). PARAMETERS
options options -H --hostname Hostname. -p --port Port number. --aetitle Set calling AE Title. --call Set called AE Title. mode options --echo C-ECHO (default when none). --store C-STORE. --find C-FIND. --move C-MOVE. C-STORE options -i --input DICOM filename -r --recursive recursively process (sub-)directories --store-query Store constructed query in file C-FIND/C-MOVE options --patientroot C-FIND Patient Root Model. --studyroot C-FIND Study Root Model. --patient C-FIND Query on Patient Info (cannot be used with --studyroot). --study C-FIND Query on Study Info. --series C-FIND Query on Series Info. --image C-FIND Query on Image Info. --key 0123,4567=VALUE for specifying search criteria (wildcard allowed) With --key, leave blank (ie, --key 10,10="") to retrieve values C-MOVE options -o --output DICOM filename / directory --port-scp Port for incoming associations --key 0123,4567=VALUE for specifying search criteria (wildcard not allowed) Note that C-MOVE supports the same queries as C-FIND, but no wildcards are allowed general options -h --help print this help text and exit -v --version print version information and exit -V --verbose verbose mode (warning+error). -W --warning warning mode, print warning information -E --error error mode, print error information -D --debug debug mode, print debug information --queryhelp print query help environment variable GDCM_ROOT_UID Root UID C-ECHO usage gdcmscu is a great tool to test if a DICOM server is up. For example to send a C-ECHO to server dicom.example.com using port 104, use: $ gdcmscu dicom.example.com or if you prefer being explicit: $ gdcmscu --echo dicom.example.com 104 Using basic security your DICOM server might require that you set the appropriate called AE-TITLE $ gdcmscu --echo dicom.example.com 11112 --call SERVSCP If you want to specifiy your own AE-TITLE (default is GDCMSCU), simply use: $ gdcmscu --echo dicom.example.com 11112 --call SERVSCP --aetitle MYSCU For example you could test on the DICOM server provided by DICOMObject team: $ gdcmscu www.dicomserver.co.uk 11112 C-STORE usage C-STORE is the operation that allow sending a DICOM file to a remote DICOM server. For instance to send a file called myfile.dcm $ gdcmscu --store dicom.example.com 104 myfile.dcm or if you prefer being explicit: $ gdcmscu --store dicom.example.com 104 -i myfile.dcm You can even send multiple files using the same association: $ gdcmscu --store dicom.example.com 104 myfile1.dcm myfile2.dcm myfile3.dcm ... C-FIND usage gdcmscu also allow querying a DICOM server. This is the C-FIND operation, for example to find all DICOM Instance where PatientsName match a particular pattern, usage is simply: $ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10,"A*" We also support a DCMTK compatible convention: $ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="A*" When an attribute is set without a value it will be part of the output result: $ gdcmscu --find --patient dicom.example.com 11112 --call MI2B2 --patientroot -k 10,10="A*" -k 10,20 C-MOVE usage C-MOVE is the operation to retrieve a DICOM instance from a remote DICOM server. Most of the time, it is a subsequent operation after a C- FIND query. To retrieve a DICOM instance where PatientID is ABCD1234, simply execute: $ gdcmscu --move --patient --aetitle ACME1 --call ACME_STORE dicom.example.com 5678 --patientroot -k 10,20="ABCD1234" --port-scp 1234 WARNING For this operation to work you need information from the DICOM server you are communicating with. Only the DICOM server you are sending a C-MOVE query will be reponsible for sending back incoming associations (the actual C-STORE SCP). Therefore you need to make sure that you mapping of (AE-TITLE,PortNumber) is properly set on the DICOM server side as well as the port for incoming association (--port- scp). gdcmscu does not currently support external C-STORE association (C-STORE request sent to an external SCP application). patientroot notes The flag --patientroot is just simply a wrapper around the syntax --key 8,52=PATIENT For instance one would write using DCMTK syntax: findscu --patient dicom.example.com 11112 --key 8,52=PATIENT --key 10,10="F*" This would become using GDCM syntax: $ gdcmscu --find --patient dicom.example.com 11112 --patientroot --key 10,10="F*" Debugging This is sometime difficult to investigate why a connection to a remote DICOM server cannot be done. Some recommendations follows: Always try to do a simple C-ECHO at first. If you cannot get the C-ECHO to work none of the other operations will work Before trying to a C-MOVE operation, make sure you can execute the C-FIND equivalent query first. When doing a C-MOVE operation you really need to communicate with the PACS admin as the C-MOVE operation is different from the other lower level operation such as HTTP/GET. When doing a C-MOVE, the server will communicate back using another chanel (could be different port) using it's internal database to map an AE-TITLE back to the destination IP. Indeed the C-MOVE operation by design does not always use your incoming IP adress to send back the resulting dataset. Instead it uses a mapping of AE-TITLE to IP adress to send back any results. So pay particular attention to the spelling of your AE-TITLE and your incoming port (which may be different from the port to connect to the server). Port Warning Watch out that port ranging [1-1024] are reserved for admin and not easily accessible unless granted special priviliges. Therefore the default 104 DICOM port might be accessible to all your users. C-STORE Warnings When constructing a C-STORE operation, gdcmscu will always use the Media Storage as found in the file to be sent. For encapsulated DICOM file (eg. RLE Lossless) the receiving SCP server might not support this compression and will legitemely refuse the C-STORE operation. In this case users have to manually convert to a non-compressed form this particular file: $ gdcmconv --raw compressed.dcm non_compressed.dcm C-MOVE Warnings At the moment gdcmscu only supports non-compressed transfer syntax. It will always request DataSet using Implicit VR Little Endian Transfer Syntax during a C-MOVE operation. C-FIND IMAGE level (Composite Object Instance) One should pay attention that gdcmscu --find and findscu are not completely equivalent. Using gdcmscu --find, all Unique Keys will be added automatically. One can therefore execute something like this: $ gdcmscu --find --patientroot --image --key 8,18=1.2.3.4.5.6 dicom.example.com 11112 instead of the more explicit form $ gdcmscu --find --patientroot --image --key 8,18=1.2.3.4.5.6 dicom.example.com 11112 --key 10,20 --key 20,d --key 20,e This would also be equivalent to: $ findscu --patient --key 8,52=IMAGE --key 8,18=1.2.3.4.5.6 dicom.example.com 11112 --key 10,20 --key 20,d --key 20,e Storing the Query It is also possible to store the query: gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,20="*" --key 10,10 --store-query query.dcm One can then check the DataSet values send for the query: $ gdcmdump query.dcm # Dicom-File-Format # Dicom-Meta-Information-Header # Used TransferSyntax: # Dicom-Data-Set # Used TransferSyntax: 1.2.840.10008.1.2 (0008,0005) ?? (CS) [ISO_IR 192] # 10,1-n Specific Character Set (0008,0052) ?? (CS) [PATIENT ] # 8,1 Query/Retrieve Level (0010,0010) ?? (PN) (no value) # 0,1 Patient's Name (0010,0020) ?? (LO) [* ] # 2,1 Patient ID The Specific Character Set was set to 'ISO_IR 192' as the locale encoding of the system was found automatically by gdcmscu to be UTF-8. This means that the following command line will properly setup the Query with the appropriate Charset to be executed correctly: $ gdcmscu --find --patient --patientroot dicom.example.com 11112 --key 10,10="*Jerome*" the query is always executed on the server side (SCP), some implementations does not support string matching with different Character Set. SEE ALSO
gdcmconv(1) COPYRIGHT
Copyright Insight Software Consortium Version 2.2.0 Tue Feb 5 2013 gdcmscu(1)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy