I'd just like to know if its possible to change the actual line/row position in awk while its busy processing a file. In other words, is it possible to jump from line 10, back up to line 5 and continue processing line-by-line from then onwards? or is the way around this to add all lines to an array and jump between lines within the array?
Example:
A file contains N records. Each record has a corresponding/matching record (in no particular order)
record1(pair1)
record2(pair2)
record3(pair3)
record4(pair1) #match for record1
record5(pair4)
record6(pair3) #match for record3
record7(pair2) #match for record2
...
..
.
A generic script to hopefully assist in my explaination.
I apologize in advance if this question has already been asked.
No, you cannot "jump" back, but you can always process the same file twice in one go.
If you provide a more descriptive sample input and a desired output, we could probably avoid guessing/jumping...
Wow, that was quick. Thanks for your responses guys.
Sorry, I'm unable to provide you with a more descriptive sample input. vgersh99, your response was all I needed. I can now go and explore other solutions.
Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position?
I am asking this because the file I have doesn't always follow a pattern.
For example the file I have is the result of a command to obtain windows ACLs:
icacls C:\ /t... (5 Replies)
Hi everyone..
I have a list of values in a file...
a,
b,
c,
1,
2,
3,
aaaa,
bbbbb,
I am interested in converting this column to a row..
"text",aaaa,
bbbb
a,1 (7 Replies)
Hi
I have file "emp.txt"like below
Emp Id Name
123 aa
123 bb
223 cc
233 dd
334 ee
Please help me to know that the position of the blank row. (5 Replies)
I have several questions about using awk. I'm hoping someone could lend me a hand. (I'm also hoping that my questions make sense.)
I have a file that contains pipe separated data. Each line has similar data but the number of fields and the field position on each line is variable. ... (3 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (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)
HI ,
My unix command output look like below ,
bste-ngh-bt9.hecen.com
EA1981,
09/01/2010 17:56:56
03/31/2011 00:00:00
I want this output changed to , all i need in one line with space !
bste-ngh-bt9.hecen.com EA1981 09/01/2010 17:56:56 03/31/2011 00:00:00
need to get all in... (17 Replies)
I want to write a scrpit to merge files row wise (actually concatinating)
main.txt
X Y Z
file 1
A B C
file 2
1 2 3
now i want the script to check if the file1 is empty or not, if empty then make it like
A B C
1 2 3
again to check if second file is empty if not do as done... (0 Replies)