Sponsored Content
Top Forums UNIX for Dummies Questions & Answers where is the problem in my sed command.... Post 302115083 by reborg on Friday 20th of April 2007 03:51:02 PM
Old 04-20-2007
Code:
sed 's/^\([^ ][^ ]*\) \([^ ][^ ]*\)/\2 \1/' file > swapfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed command problem

Hi! here is my problem : $ more file yopyop:FIToB8df02f:10200:351:yoyo:/home/yopyop:/usr/bin/ksh $grep yopyop file | sed s/FIToB8df02f/passe/ yopyop:passe:10200:351:yoyo:/home/yopyop:/usr/bin/ksh $more file yopyop:FIToB8df02f:10200:351:yoyo:/home/yopyop:/usr/bin/ksh ...when i... (1 Reply)
Discussion started by: tomapam
1 Replies

2. Shell Programming and Scripting

sed command problem

I am cating a file with passwords into another file. I want to replace the the password with **** and it is not working. Here is my command cat testing | sed 's/`echo ${pass}`/*****/'>>out1 ${pass} is the password that I want to replace before it goes into out1 Anyone know what I am... (1 Reply)
Discussion started by: lesstjm
1 Replies

3. Shell Programming and Scripting

sed command problem

hi I am using "sed" command to find and replace a text in a file. if the searched string is in the last line with no newline character in the end, it doesn't retrive this line. What is the solution to this? i am using sed as: sed -e "s/abc/ABC/g" test.txt where i am replacing abc with ABC (11 Replies)
Discussion started by: dharmesht
11 Replies

4. UNIX for Dummies Questions & Answers

Problem while using Sed command

I want to write the output of From_Date_Parm and To_Date_Parm to the target file. I want to write a script by passing the filename. In my case the file is TransactionParams I tried it through command line. noofdays=TransactionParams sed... (2 Replies)
Discussion started by: gopskrish
2 Replies

5. Shell Programming and Scripting

problem in sed command

Hi, i have a script to replace a string. $ cat List.txt /DIR1/DIR2/DIR3/abcdefgh /DIR1/DIR2/DIR3/abcd /DIR1/DIR2/DIR3/abcdefghijk /DIR1/DIR2/DIR3/xyz $ ind=`/DIR1/DIR2/DIR3/abcd` $ replace=`#/DIR1/DIR2/DIR3/abcd` $ sed "s|$find|$replace|g" List.txt>cat NewList.txt The aim of... (3 Replies)
Discussion started by: tsaravanan
3 Replies

6. UNIX for Dummies Questions & Answers

Problem with sed command

Hi, I used sed command to replace õ character. sed -n '1,$s/õ/o/gp' inputfile > outputfile The problem is there are 5 records in input file and 2 records has that õ character. So after using the sed command, in output file Iam getting only those records which has character õ replaced by o.... (2 Replies)
Discussion started by: manneni prakash
2 Replies

7. Shell Programming and Scripting

i need help in sed command problem

i use 'sed' with this syntax " sed "/$lineerr/d" $fileerr > $fileerr"_Bak" && mv $fileerr"_Bak" $fileerr" it's work to remove the line that have the word in $lineerr but it also remove my last line in file too. - -" my input File $ cat fileerr.txt xx|1111111111 xx|2222222222... (5 Replies)
Discussion started by: Chalot99
5 Replies

8. Shell Programming and Scripting

Problem with sed command

Hi, I have a file with data demo_abc demo abc demo-abc abc Now i need to extract only abc from all the lines and print. i used the pattern /*$/ . Can any one help me how to extract text "abc" only. (5 Replies)
Discussion started by: krishna_gnv
5 Replies

9. UNIX for Dummies Questions & Answers

sed command problem

Hi i am reading a tutorial on sed below command was given in tutorial. i am not able to understand the working of below command also this command is now working in my enviroment. $ sed -n '1~2p' alarm sed: 1: "1~2p": invalid command code ~ $ need your assitance here (7 Replies)
Discussion started by: scriptor
7 Replies

10. UNIX for Beginners Questions & Answers

Problem with using sed command

I have tried to print the commands which are executed today from history file using sed command by putting the range but i am unable to get it.can anyone help with this is script.I am pasting the script below that i have tried . today=$(date "+%F") echo $today yest=$(date --date="yesterday" ... (2 Replies)
Discussion started by: iosjsk
2 Replies
KVM_OPEN(3)						   BSD Library Functions Manual 					       KVM_OPEN(3)

NAME
kvm_open, kvm_openfiles, kvm_close -- initialize kernel virtual memory access LIBRARY
Kernel Data Access Library (libkvm, -lkvm) SYNOPSIS
#include <fcntl.h> #include <kvm.h> kvm_t * kvm_open(const char *execfile, const char *corefile, const char *swapfile, int flags, const char *errstr); kvm_t * kvm_openfiles(const char *execfile, const char *corefile, const char *swapfile, int flags, char *errbuf); int kvm_close(kvm_t *kd); DESCRIPTION
The functions kvm_open() and kvm_openfiles() return a descriptor used to access kernel virtual memory via the kvm(3) library routines. Both active kernels and crash dumps are accessible through this interface. The execfile argument is the executable image of the kernel being examined. This file must contain a symbol table. If this argument is NULL, the currently running system is assumed, as determined from getbootfile(3). The corefile argument is the kernel memory device file. It can be either /dev/mem or a crash dump core generated by savecore(8). If corefile is NULL, the default indicated by _PATH_MEM from <paths.h> is used. It can also be set to a special value /dev/null by utilities like ps(1) that do not directly access kernel memory. The swapfile argument is currently unused. The flags argument indicates read/write access as in open(2) and applies only to the core file. Only O_RDONLY, O_WRONLY, and O_RDWR are per- mitted. There are two open routines which differ only with respect to the error mechanism. One provides backward compatibility with the SunOS kvm library, while the other provides an improved error reporting framework. The kvm_open() function is the Sun kvm compatible open call. Here, the errstr argument indicates how errors should be handled. If it is NULL, no errors are reported and the application cannot know the specific nature of the failed kvm call. If it is not NULL, errors are printed to stderr with errstr prepended to the message, as in perror(3). Normally, the name of the program is used here. The string is assumed to persist at least until the corresponding kvm_close() call. The kvm_openfiles() function provides BSD style error reporting. Here, error messages are not printed out by the library. Instead, the application obtains the error message corresponding to the most recent kvm library call using kvm_geterr() (see kvm_geterr(3)). The results are undefined if the most recent kvm call did not produce an error. Since kvm_geterr() requires a kvm descriptor, but the open routines return NULL on failure, kvm_geterr() cannot be used to get the error message if open fails. Thus, kvm_openfiles() will place any error mes- sage in the errbuf argument. This buffer should be _POSIX2_LINE_MAX characters large (from <limits.h>). RETURN VALUES
The kvm_open() and kvm_openfiles() functions both return a descriptor to be used in all subsequent kvm library calls. The library is fully re-entrant. On failure, NULL is returned, in which case kvm_openfiles() writes the error message into errbuf. The kvm_close() function returns 0 on success and -1 on failure. SEE ALSO
open(2), kvm(3), kvm_getargv(3), kvm_getenvv(3), kvm_geterr(3), kvm_getprocs(3), kvm_nlist(3), kvm_read(3), kvm_write(3), kmem(4), mem(4) BUGS
There should not be two open calls. The ill-defined error semantics of the Sun library and the desire to have a backward-compatible library for BSD left little choice. BSD
January 29, 2004 BSD
All times are GMT -4. The time now is 09:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy