I am not sure how to distinguish between the first and second line in your example - they differ only in the content of the penultimate field ("General y miscelánea" vs. "General and miscellaneus").
Based on scrutinizers solution and assuming these two are just two examples and you do not have to differentiate:
This will change the "4001" in your example to "Quimica" in all lines having "650" in the second field.
The only diferrence between both records is one is in spanish and the second is in english.
This is a library catalogue with references to BOOKS, so some books exists in several languages.
So if we take my exemple:
Am other exemple (other record)
So I need to replace all the code after the ;
I have the correspondance for all the codes.
---------- Post updated at 06:29 AM ---------- Previous update was at 06:14 AM ----------
Hi
sorry
to be more clear, maybe I should explain the issue from the begining...
The file is a list of bib records like this:
As you see, LDR and FMT are the start and end of each record.
AS you see, there is a field 650 with some values.
So the objective is to replace the value in each record...by its correspondence (a string as Quimica....etc) in spanish and english.
Some of this records have fields 650 with only one value, but others have 2 values.
The results for the exemple will be:
This code is ok if you have only one value:
But if I have 2 values...it do not works.
Thanks in advance
Understood. I noticed the difference, but wasn't sure if this constitutes the distinctive criterion. In your case, i presume, there is nothing left than to ad-hoc-replace the lines parts:
Some caveats: probably the asterisk in "QuÃ\*mica1" is from differing code pages used, but generally speaking, there are some characters which have a special meaning to sed (asterisk is among them). If you want to match for such a character you will have to precede it with a backslash as escape character. To match an asterisk you will have to search for "\*", not "*", like i did above.
In your second example you have whitespace between the last semicolon and the number following it ("; 4007" instead of ";4007"). If this isn't a typo you will have to change all the matching patterns like this. Notice the added space in the character range definition ("[ 0-9]" instead of "[0-9]"):
Hi
ok so imagine I have a big list of correspondences, in my exemple it was:
000000001 650 L $$a59000;4001
But there is a lot of code more...
000000001 650 L $$a01000;30000
etc
In reality, only the 2 first number are relevant.Look this list:
01 => stringOne/filaUno
02 => stringTwo/filaDos
30 => ...
40 => ...
So if I have 59000 in the field 650, I must take the corresponance of 59
So in the sed commande I must tell that depending of the 2 first number it's a correspondence or an other...
---------- Post updated at 06:45 AM ---------- Previous update was at 06:44 AM ----------
Hi
and the * is a copy paste issue I think because the real world is:
Química
QuÃ\*mica1
---------- Post updated 05-19-10 at 05:27 AM ---------- Previous update was 05-18-10 at 06:45 AM ----------
Hello
forget the last post, I resolve this by other way.
Now I just need to remove lines like this:
The common point is this:
The rest can be different
Is there any way to tell SED to remove all the line starting as this pattern?
Hi all,
I have this input:
"203324780",,"89321213261247090146","VfdsD150","0D","fd3221","V0343","aaa","Direkt","fsa","2015.02.27","39833,54454,21214",,,"fd","NORMAL","D","10fd","1243 Flotta","HiĂĄnytalan","2013.02.25",,"2013.02.25","2013.02.24","2013.02.28",,"SajĂĄt... (4 Replies)
Hi I have the following kind of line sin my file .
print ' this is first'.
print ' this is firs and next '
' line continuous '. -- this is entire print line.
print ' this is first and next '
' line continuous and'
'still there now over'. -- this 3lines together a single print line.
... (5 Replies)
Hi All,
I have output like this below
ldprod/03
ldprod/02
ldprod/01
ldprod/00
ldnprod/
ldnprod/030
I want only remove all character including /
ldprod
ldprod
ldprod
ldprod
ldprod
ldnprod (8 Replies)
Hi,
I am new to Sed and would like to know if it is possible to remove the characters .
I have a couple of files with a keyword and would like to remove the substring.
I am Using sed s/// but Its not working
Thanks for your Support
Andrew Borg (2 Replies)
Can somebody explain why my sed command is not working.
I do the folloinwg:
Generates a binary file to /tmp/x1.out
/usr/lib/sa/sa2 -s 4:00 -e 8:00 -i 3600 -A -o /tmp/x1.out
decodes the file (no problem so far)
sar -f /tmp/x1.out
When I do this it does not appear to delete the... (4 Replies)
Hello and thx for reading this
I'm using sed to remove only the leading spaces in a file
bash-280R# cat foofile
some text
some text
some text
some text
some text
bash-280R#
bash-280R# sed 's/^ *//' foofile > foofile.use
bash-280R# cat foofile.use
some text
some text
some text... (6 Replies)
i tried the following:-
sed -e file 's/^@//g' > temp
also tried
sed -e file 's///g' > temp
nothing happened....can someone please tell me wht is wrong???
also someinformation abt the character "^@"(it is ONLY ONE character and NOT TWO characters)
thanx in advance.. (13 Replies)