Sponsored Content
Full Discussion: Manipulate file
Top Forums Shell Programming and Scripting Manipulate file Post 302728965 by elixir_sinari on Thursday 8th of November 2012 09:35:37 PM
Old 11-08-2012
This does everything you want to be done.
Code:
awk '/^[0-9]+/{
if((n=split($1,a,/-/))>1) {
 if(a[n]==$3) next
 $0=$1
} else {
 if($3==$5) next
 $0 = $1 "-" $5
}
}1' infile


Last edited by elixir_sinari; 11-08-2012 at 11:01 PM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

manipulate csv file to add columns

Hi, I have a csv file with a key composed by 3 columns and some other numeric fields and I need to obtain the partial amounts by some part of the key. This may be some difficult to understand, so better see an example, where my input file is: name,surname,department,y2004,y2005,y2006... (6 Replies)
Discussion started by: oscarmon
6 Replies

2. Shell Programming and Scripting

How do manipulate file path and names

In emacs elisp, there is a handy function called file-name-nondirectory which accepts a path and file name and returns just a file name and extension. There is also a function called file-name-directory which just returns the dire ctory name without the file. How can I implement these same... (2 Replies)
Discussion started by: siegfried
2 Replies

3. Shell Programming and Scripting

sed script to manipulate the /etc/passwd file

Hi. Can anybody help me with a script to extract usernames, shell and home_directory from the /etc/passwd file. I am stuck (2 Replies)
Discussion started by: Pauline mugisha
2 Replies

4. Shell Programming and Scripting

Extract File line and manipulate

How can I print a section of each line in a text file. Eg CODE1 XYR Test2 10319389 CODE2 XYR Test2 10319389 CODE3 XYR Test2 10319389 CODE4 XYR Test2 10319389 CODE5 XYR Test2 10319389 First thing that would be nice would a new file like, awk sed and substring may help but can't figure it... (6 Replies)
Discussion started by: kelseyh
6 Replies

5. Shell Programming and Scripting

Shell script to manipulate a file

Hello, I have a file with following contents : WSL SRVGRP=LISTENER SRVID=2 CLOPT="-A -t -- -n 0x0002aa050a03cc65 " RQPERM=0660 REPLYQ=Y RPPERM=0660 MIN=1 MAX=1 CONV=N I need to print only the value in Hex i.e.... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

6. UNIX for Dummies Questions & Answers

Manipulate and move columns in a file

Hello Unix Gurus, I have a request 2 perform several functions on a file, delete columns, delete rows based on column value, and finally move around columns in the final output. Consider the following input file with 12 columns; ... (1 Reply)
Discussion started by: chumsky
1 Replies

7. Shell Programming and Scripting

Find string in one file and manipulate other

hi, I have 2 files delimited by "|" File 1: 1|28|ABC|11|9620034||XXX555| 29|22|ABC|11|9620258||XXX555| 51|26|ABC|11|9620314||XXX555| 77|20|ABC|11|9630506||XXX555| 97|36|ABC|11|9630562||XXX555| File 2: 9620028|I 9620034|I 9620314|S 9620332|I 9620258|I 9630506|S 9630562|S (3 Replies)
Discussion started by: pparthiv
3 Replies

8. Shell Programming and Scripting

nawk script to manipulate txt file

Hi experts, I am not familiarised using nawk/awk to manipulate txt file. So I need ur help here. thanks. txt1 - qc_m.log TQC101 TQC102 TQC103 TQC104 txt2 - resultEqpt.log TQC102,,LOGOFF TQC103,,LOGOFF TQC104,2012-10-03 07:42:57,LOGON so TQC101 is not found in txt 2. ... (15 Replies)
Discussion started by: ment0smintz
15 Replies

9. Shell Programming and Scripting

Manipulate a CSV File

Hello, How do i manipulate .csv file to this format? Thank you very much. Source: john,5 marco,7 john,4 paul,3 marco,8 Output: john,9 marco,15 (5 Replies)
Discussion started by: tara123
5 Replies

10. Shell Programming and Scripting

Manipulate the text file in UNIX

Hi All, I have a file like below and i have 2 questions on this (They are 3 lines starts with 01 , 02 and 03. but is 01abc333644554 234 2334535 34534535355353 sfsdf345455 353 4543 jgkg tty 7676 02cdesdfsdfsdf 234 wesdfsdf 345345 234234 234234 2342342 dfgdfg sdfgg dgdgdg fgvfs... (6 Replies)
Discussion started by: siva.pitchai
6 Replies
STG-SINK(1)							   StGit Manual 						       STG-SINK(1)

NAME
stg-sink - Send patches deeper down the stack SYNOPSIS
stg sink [-t <target patch>] [-n] [<patches>] DESCRIPTION
This is the opposite operation of linkstg:float[]: move the specified patches down the stack. It is for example useful to group stable patches near the bottom of the stack, where they are less likely to be impacted by the push of another patch, and from where they can be more easily committed or pushed. If no patch is specified on command-line, the current patch gets sunk. By default patches are sunk to the bottom of the stack, but the --to option allows to place them under any applied patch. Sinking internally involves popping all patches (or all patches including <target patch>), then pushing the patches to sink, and then (unless --nopush is also given) pushing back into place the formerly-applied patches. OPTIONS
-n, --nopush Do not push back on the stack the formerly-applied patches. Only the patches to sink are pushed. -t TARGET, --to TARGET Specify a target patch to place the patches below, instead of sinking them to the bottom of the stack. -k, --keep Keep the local changes. STGIT
Part of the StGit suite - see linkman:stg[1] StGit 03/13/2012 STG-SINK(1)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy