General :: Insert (Same Template Strings) Column With VI
Jun 24, 2011
I have this piece of code with some template strings.
Code:
Big_L: $Big_L
$Big_R
$Lambda_tf
$Epsilon_1
$mu
$n_0
$ms
$Delta_R
$Epsilon_2
$Lambda_d
$Epsilon_3
$Small_N
$Small_Q
How can I insert exactly the same template strings in front of each string, but just without the '$' sign (see the first line for an example)?
View 7 Replies
ADVERTISEMENT
Jan 18, 2011
I have a two column file and I need to create a new column in between the first and second but the new column adds a value to the first. E.g.code...
I thought I had figured out how to do it with the following but it just hangs:
awk -F '{print $0,$0+25,$1}' file_in > file_out
Also tried the following to no avail:
awk -F,-v OFS,'{print $0,$0+25,$1}' file_in > file_out
I can add the new column with the added value to the last column easy ( awk '{print $0,$0+25}' file_in > file_out).
View 8 Replies
View Related
Feb 24, 2011
I have the following file.
B0 49.2230869 -102.5743868
C 1LPRK 654.90
C 1PREU 3693.90
C 1JRSU 3693.90
[code]....
I need to insert text ABCDEF starting at position 26 if a line starts with C. I need it to look like:
C 1VKNG ABCDEF 3097.00
C 1JLFU ABCDEF 3157.20
C 1MNVL ABCDEF 3346.10
I would prefer to use sed to do this and not perl.
View 14 Replies
View Related
Jul 29, 2010
I want to search and replace strings in a file with strings in other files/i need to do it with big strings(string1 is big) and i want to use a txt file for this.But this code not working :
View 14 Replies
View Related
Jul 25, 2011
On windows I really only used Notepad++ as my text editor, it had two features that I loved.What I need to accomplish is what I would do with Notepad++ column editor.I could have like 100 lines, and place the cursor at a column, and goto edit>column editor, and I could insert an incrementing number. (I could also pad the incrementing number with 0s, this was GREAT for making batch files among other things.)So each line at that column had a number higher than the previous line.The other feature that I used sometimes was a search/replace with regex patterns.Does anyone know of an editor that has those features for linux? I am mostly after the column editor insert feature but if you know of one with both features that would rock.
View 1 Replies
View Related
Jul 19, 2010
How would i calculate following values.Initial file
10 3
20 4
How would i calculate 3rd column which should be addition of value in 1 and 2nd column.File after calculation
10 3 13
20 4 24
View 14 Replies
View Related
Mar 7, 2010
i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235
grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08
[code].....
anyhow - i append two sed commands to further clarify the direction of the message.
awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36
[code]....
I tried using an awk gsub () command within the string instead of the two seds, but it did not work:
awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}
the sed works ok, but it would be cooler to make the replacement within the awk command:
gsub(/->/,-> IN, $1)
Is there a way where i could replace the value of the $1 column in the awk print string?
View 1 Replies
View Related
Jul 15, 2010
I have a multicolumn datas, like
a1 b1 ... f1
a2 b2 ... f2
. . ... .
[code]...
I would like to make a file with all these data in one column, like
a1
a2
.
.
[code]....
Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like
1 a1
2 a2
. .
. .
[code].....
View 14 Replies
View Related
Aug 23, 2010
Is there a way I can write a file that contains the text which assigns variables, e.g. string="hello world" in a file say, variables.txt and have a shell script assign those variables locally e.g.
#!bin/bash
command_that_saves_variables_locally variables.txt
echo $string
and when I run the script I would get an output of
"hello world"
View 2 Replies
View Related
Dec 28, 2010
I want to make a template for Thunderbird. I want the image to be on top and I will put fonts under it. My attempts at inserting an image have resulted in one very large image taking up the entire page.
View 2 Replies
View Related
Jan 14, 2011
creating template (phpldapadmin 1.2.0.5). I create new template where im creating User Account (possixAccount) but i need to create Generic: Ldap Alias that will be created in other ou than account and i need both in one template.
View 1 Replies
View Related
Mar 1, 2011
I need to have a syntax highlighter for a language of mine.
View 1 Replies
View Related
Nov 15, 2010
I am using sed to process an ascii tcpdump file whereby each packet is processed into a line with the same number of columns and useful information is pulled out like the time, packet type, length, and also IP addresses, payload type and port numbers where appropriate. The time is already changed to seconds, followed by the protocol over ethernet, such as IP, IP6, ARP etc. and I can change anything it detects as IP, IP6 and ARP into some other string, pulling out necessary information depending on the protocol and payload.The beginning part of the search for IP starts with the sed search /([0-9][0-9]*.[0-9][0-9]*)[ ]IP[ ,] ... /, where time is in seconds and ellipses means more stuff, and likewise for IP6 and ARP.But how do I process the lines that are NOT IP, IP6 or ARP? (Specifically NOT /IP[ ,]/, /IP6[ ,]/ or /ARP[ ,]/.) So that I can format them into a string with the same number of columns.
View 2 Replies
View Related
May 19, 2011
What would be the best way to search for a file that contains a string similar to this:
View 1 Replies
View Related
Jul 20, 2011
I'm on Ubuntu 11.04. I get the above error when running a utility to get code from a version control system (StarTeam). The error looks generic enough that I'm hoping its an easily resolvable system problem. Below is how I get it ...
Code:
$ /bin/sh -c stcmd label -x -nologo -stop -p username:password@mydomain.com:9999/NNA/NNA/Technology/nna/tools/selenium -nl selenium-utils-1.0 -b
strings: '/lib/libc.so.6': No such file
[code].....
View 1 Replies
View Related
Jan 29, 2010
Is there a faster way to search for a file containing a given string than using grep -re "string" /
This takes a long time to search through the entire system, so I was wondering if there is a faster way. I don't know the name of the file, just that it will contain a given string.
View 4 Replies
View Related
May 11, 2011
Let me know unix commands to implement set operations on strings.
View 9 Replies
View Related
Jan 15, 2010
fakeFile's contents :
Code:
blah $(date +%F) blah
fakeScript's contents :
Code:
while read line; do
echo $line
done < "fakeFile"
so here's the problem : is there any way to evaluate the fakeFile's contents (in the fakeScript), so that the term "$(date +%F)" (or any other bash script) in a string , translates to it's corresponding value ? (in this example , we want to have "blah current date" instead of " blah $(bash script) blah " )
View 9 Replies
View Related
Mar 22, 2010
I would like to find all the files that contains the strings I'm searching.
For example (it's just an example), I would like to search all the files in "/etc" that contains "eth0" and "us", whatever where are located those 2 strings, the important is that the 2 strings are in the files listed.
It would be something like a "grep -lr 'eth0' *" and "grep -lr 'us' *" but in one time/command, so that I don't have to make a comparison of the 2 list of files resulting from the 2 "grep" commands given higher.
View 10 Replies
View Related
Feb 3, 2011
Long story short, I got a folder with nearly 800,000 php files. I would like to search each file for a string and if it exists in that file, the file gets copied to another directory. Is this possible from the terminal? So far I got: grep -i -n -r 'ppr-1792' * | cp $1 move_to_here
But this obviously doesn't work. $1 needs to be the file name that contains matching text.
View 2 Replies
View Related
Oct 5, 2010
I've been surfing and searching the net quit a while now to make my own script, but I haven't been really successful ever since I want to make a script which can remove strings from my mp3 collection (file names).
For example:
Code:
101-bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3 --> bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3
10-Young Jeezy-Lose My Mind (78 Bpm) (Repack).mp3 --> young_jeezy-lose_my_mind.mp3
Now the problem is how can I remove the strings like:
101 & 10 (dynamic)
(%%% Bpm) (dynamic)
(Repack) (static)
View 11 Replies
View Related
Jan 31, 2010
In bash, I would like to remove all zeros (if exist) from the beginning of a strings:
000001234
00123
0000568
View 9 Replies
View Related
Nov 16, 2010
I have multiple strings (eg. say two, firstLIST=(0 1 2) and secondLIST=(2 3)) and want to create a single string composed of their unique sorted elements. For the sample strings above, I'd like to build masterLIST=(0 1 2 3).I suppose I could write the elements of firstLIST and secondLIST to files
Code:
echo ${firstLIST[@]} > firstFILE
echo ${secondLIST[@]} > secondFILE
then use
Code:
sort firstFILE secondFILE | uniq > masterFILE
as this gives me a file populated with the elements I'm after, but I'm not sure how to read the elements back into masterLIST... and it doesn't seem "right" to create files to accomplish this. Is there a way to do this by manipulating the strings ${firstLIST[@]} and ${secondLIST[@]} directly? The closest I've come (not close at all) is
Code:
masterLIST=${firstLIST[@]}" "${secondLIST[@]}
but masterLIST built this way has only one element
Code:
$echo ${masterLIST[@]}
0 1 2 2 3
$echo ${#masterLIST[@]}
1
and I don't have access to the individual digits to then try to figure out how to remove duplicates.
View 4 Replies
View Related
Mar 13, 2011
I'm trying to write a bash script to find all lines containing two different strings in many files. I don't have access to egrep so I want to use sed for this purpose.
The files will look like this:
FileX
------
Info:18
Data:76
Contact:me@home.com
Start:1500
I want to generate a new file from these files with only the rows containing Data and Start. Something like this:
for y in `ls /file*.db`;
do sed '/Data|Start/p' $y > newfile
done
View 7 Replies
View Related
May 16, 2011
i have a problem in finding block of identical strings...i solved the problem in finding consecutive identical words and now i want to expand the code in order to find and remove consecutive identical block of strings... for example the awk code removing consecutive identical word is:
Code:
#!/usr/bin/awk -f
BEGIN{
RS="[[:space:]]+";
ORS=""
[Code].....
View 2 Replies
View Related
Dec 9, 2010
I've got a quick grep question. I'm trying to work out a command I can use to locate all of the files in a directory that have sql database connection details. I want to do it by looking for the strings "localhost" and the name of the database.find . -type f -exec grep -l -E '^(localhost|DATABASE_NAME)' {} ;
View 4 Replies
View Related
Mar 21, 2010
I have a file with no regular way to grep or sed for any regular expression. The wordings, fields, spacings are random. code...
I want to extract character positions 3 to 10 including spaces. code...
View 8 Replies
View Related
May 10, 2011
I got requirement to find the difference between two strings and write the difference to new file by comparing the substrings separted by commas
Below mentioned is an example of requirement
String1 --> ABC,DEF,GHI,JKL
String2 --> MNO,ABC,XYZ,DEF
In String1 and String2 the substrings are separted by commas. The substrings which are common between String1 and String2 are ABC,DEF this common substrings has to be written to a file say common.txt ( having the text ABC,DEF). And the substrings GHI,JKL in String1 which are not present in String2 has to be written to another file say String1Extra.txt (having the text GHI,JKL). In the same way the substrings MNO,XYZ from String2 which are not present in String1 has to be written to another file say String2Extras.txt(having the text MNO,XYZ) .
View 1 Replies
View Related
Jul 29, 2010
what command is to be used to call strings from other files to the script and then comparing strings from two different files in the script to check if strings are matched then return the result to another script.
View 1 Replies
View Related
Nov 2, 2010
I'm studying about signal in Linux Kernel and I got a problem about signal handler and output buffer.
I just want to know about stdout buffer related parent process and child process.
The problem is - parent process received SIGINT signal_handler that I implement is called. And after signal_handler is called, it print string "pid : xxx state : RUNNING" ... but after end of signal_handler function, child process might be print string but it isn't print at all.
I'm not asking right code, but I want to know why is this happened and concepts about signal handler, buffer - between parent process and child process.
here is a code signal_handler:
Quote:
void TC3_handler()
{
pid_t pid;
ProcState ps;
pid = GetProcessId();
[Code]....
chlid process counts number in infinite loop, but after call signal_handler, it can't print at all.. just waiting for SIGINT..
View 2 Replies
View Related