Trying to move a column into another position within a sed script
Currently the table looks like this
This is what i am trying to do
I am trying to do this within one sed shell script and have tried (not all of these are changing the whole table just a few columns just to try and see what works/doesn't)
s/^\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)\([^,]*,\)$/\1\3\2\4\5\6\7\8\9\0/g
Identify the First Column Position in Second Column and add the position value in 3rd column.
Sample data:
a|c
b|d
c|a
d|b
e|e
f|g
g|f
|h
|i
Expected Output:
a|c|1
b|d|2
c|a|3
d|b|4 (6 Replies)
hi guys,
i want command or script to display the content of file from 2nd position to last but one position of a file
abcdefghdasdasdsd
123,345,678,345,323
434,656,656,656,656
678,878,878,989,545
4565656667,65656
i want to display the same above file without first and... (2 Replies)
Hi, I have a file with +/- 13000 lines and 4 column. I need to search the 3rd column for a word that begins with "SAP-" and move/skip it to the next column (4th). Because the 3rd column need to stay empty.
Thanks in advance.:)
89653 36891 OTR-60 SAP-2
89653 36892 OTR-10 SAP-2... (2 Replies)
i have this prob
I have some records in a file1 like this
1001 sajal singh tampa
1002 .... so on
i have a pattern file which is like this
1,4 4,13 14,15
i have to read the first pair 1,4 and extract that from the first record
so the pattern is 1001
now i have to scramble 1001... (1 Reply)
Hi All,
I am having a file which contains negative numbers, wht i am doing is re-formattting the file(moving few columns and add few hard codings between), while reformatting i would want the negative numbers to have the sign as trailing rather than leading.
Existing
-2400.00
34
0.00... (11 Replies)
I want to remove text from nth position to nth position couple of times in same line
my line is
"hello is there anyone can help me with this question"
I need like this
ello is there anyone can help me with question
'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Dear friends,
Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number.
Program
COUNT=1
for MYDIR in `ls /`
do
VOBS=${MYDIR}
echo "${COUNT}. ${MYDIR}"
... (4 Replies)
Hi,
How can i move to particular line and to a particular position in a file using unix commands ?
eg: in the line 30 and position 10 i want to print my name in a file.
Cheers,
Mohan (1 Reply)
Problem discription:
I have many files which contain the same lines.
for instance, (15 lines) file1 ..last column add by hand arbitrarily.
1.78116800 0.68396600 0.00061900
0.47641600 -0.49794500 -0.00024000
-1.70662800 0.29577100 0.67863600
-1.70647600 0.29654600 ... (9 Replies)
Hi All,
I have a comma separated value (.CSV) file like the one below. The file contains about 20000 lines.
FileName
EmpNo,Name,Age,Sex,Band,Spouse,Children,Salary,
1000,Arnold,24,M,B,N.A.,No,10000,
1001,Jenny,27,F,C,John,2,20000,
...................................
What i need is to... (1 Reply)